+ 1
Syntax is apparently wrong
I am trying to run my code but it says the syntax is wrong. Its specifically highlights the colon at the end of the first if statement ('ID':) but I am pretty sure it is right. I am not sure how to fix it. #Nested if-statement for going inside a club item1 = input('Present first item please: ') item2 = int(input('Present second item please: ') if item1 == 'ID': if item2 == '10': print('You may enter') else: print('You may not enter without paying') else: print('You may not enter without paying or presenting identification')
2 Antworten
+ 4
Problem #1
item2 = int(input('Present second item please: '))
* Missing right side parentheses
Problem #2
if item2 == '10':
* <item2> is supposedly an int and you are testing it against a string.
Do like this
if item2 == 10:
+ 2
Thank You. It worked