0

Im getting error in this simple code, pls help me out!!

im just tryna make this simple ticket counter thingy but it keeps saying syntax error, pleas help

5th May 2023, 8:48 AM
Jayaditya Sharma
Jayaditya Sharma - avatar
4 odpowiedzi
+ 1
#DONT FORGET TO PUT YOUR AGE IN INPUT OK??? #Ticket Cashier Machine #Enjoy And Leave A Like Please! for i in range(3): print("Purchasing Ticket..." #Price according to age age = str(input()) if age < str(18): print("Juniour Discount Applied") elif age >= str(60): print("Senior Discount Applied") else: print("No Discount Applied") print("Proceed To Payment")
5th May 2023, 8:49 AM
Jayaditya Sharma
Jayaditya Sharma - avatar
+ 1
Why are you casting age to string?
5th May 2023, 9:07 AM
Emerson Prado
Emerson Prado - avatar
0
syntax error is probably from the unclosed print( up top, but also you should be using int not str, or it'll behave strangely. In Python, string inequalities sort by alphabetical order, so a 9 year old will be older than a 85 year old (9 comes after 8). 7 year olds will get the senior discount, while 6 year olds will have to pay full price. on a more minor note, did you mean to print "Purchasing Ticket..." 3 times?
5th May 2023, 10:03 AM
Orin Cook
Orin Cook - avatar
0
Ohhhh thanks! I got it!
6th May 2023, 4:50 PM
Jayaditya Sharma
Jayaditya Sharma - avatar