Python餐厅价格+提示

时间:2016-09-22 22:21:17

标签: python

我根本不理解

bill = float(input("How much did the meal cost? "))
people = input("How many people are available to pay? ")

if bill < 50:
    bill2 = 1 * bill+10
else:
    bill2 = 1 * bill+20 

print("Between everyone the meal costs", bill2 / people)



ERROR: 

    print("Between everyone the meal costs", bill2 / people)
TypeError: unsupported operand type(s) for /: 'float' and 'str'

1 个答案:

答案 0 :(得分:1)

试试这个:

print("Between everyone the meal costs", bill2 / int(people))

其他解决方案是投人投入:

people = int(input("How many people are available to pay? "))