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
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")
+ 1
Why are you casting age to string?
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?
0
Ohhhh thanks! I got it!