Winter Winter - 2 months ago 5
Python Question

Python Restaurant Price + Tip

I do not understand this at all

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'

Answer

try this:

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

other solution is cast people input:

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