预期的字符串,而是浮点数

时间:2019-10-16 06:28:36

标签: python python-3.x

在线

    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))

0 个答案:

没有答案