【发布时间】:2017-10-26 12:43:06
【问题描述】:
请不要只给出答案。我是新手,这是我的学习方式。如果您能多花点时间解释一下原因或方式,我将不胜感激。
我需要获取我希望用户输入的多个输入:ID、金额、小费金额。金额和小费的多个实例。然后移植到文本文件 类似这样的格式:日期、员工编号、金额、总金额、小费金额、小费总和。
## Program gets the date, Employee ID, and amounts.
## It then places them into a text file which can be ported to excel.
## Get Date
## Get Employee I.D.
empnum = raw_input('Please enter Employee Number\n')
## Gets the amounts.
num1 = raw_input('Please enter Ticket amount.\n')
num2 = raw_input('Please enter tip amount.\n')
## Sum of the amounts.
sum = float(num1) + float(num2)
## Information to be ported to text file.
## Date, Employee ID, amount, Total sum of amount, tip amount, total sum of tip
print'Employee ' + empnum + ' total is'
print(sum)
【问题讨论】: