0
What’s wrong with my code? Python
Please help me, what’s wrong with line 5? print("Welcome to the tip calculator!") bill = float(input("What was the total bill?
quot;)) tip = int(input("How much tip would you like to give? 10, 12, or 15? ")) people = int((input("How many people to split the bill? ")) bill_with_tip = tip / 100 * bill + bill print(bill_with_tip) bill_per_person = bill_with_tip / people final_amount = round(bill_per_person, 2) final_amount = "{:.2f}".format(bill_per_person) print(f"Each person should pay: {final_amount}")7 Antworten
+ 4
Too many ( at the line with people
Should be
people =int(input("How many people to split the bill?"))
+ 3
Sometimes it says line ### but your error is on the line earlier.
When responding to errors, you have to check & fix the first error before trying to fix errors in later lines. In this case, your line 4 had too many opening parentheses, causing the interpreter to think line 5 was still part of line 4.
+ 2
Lilit Harutyunyan
HungryTradie has hit the nail on the head, too many ( in the line of the variable people
print("Welcome to the tip calculator!")
bill = float(input()) # bill total
tip = int(input()) /100 # tip percentage
people = int(input()) # splitbill num
bill_with_tip = bill * tip + bill
print(bill_with_tip)
bill_per_person = bill_with_tip / people
final_amount = round(bill_per_person, 2)
final_amount = "{:.2f}".format(bill_per_person)
print(f"Each person should pay: {final_amount}")
+ 2
Timz2 laugh
tip percent is an undeclared variable, which is also not created validly
+ 1
I have a SyntaxError with line 5(((
+ 1
Thanks you all
HungryTradie you are right-the problem was with unnecessary parenthes in the line 4
0
Hello everyone, please help out here, what's wrong with my line 3, it brings out a syntx error
bill = float(input("enter bill"))
tip = int(input("tip percent "))
total_bill = (tip percent + 100) * bill/100
total = round(total_bill, 2)
print(total_bill)