在线
print(name + "'s pay=$" + pay)
它告诉我它是预期的字符串,但已浮动
pay_list = []
while True:
name = input("Enter employee's name: ")
if name == "zzzz":
break
hours = float(input("Enter employee's hours worked: "))
rate = float(input("Enter employee's hourly rate of pay: "))
if hours > 40:
pay = rate * 40 + (hours - 40) * 1.5 * rate
else:
pay = rate * hours
pay_list.append(pay)
print(name + "'s pay=$" + pay)
print("Total pay =" + sum(pay_list))