-1
print("Welcome to the Ontario Science Centre! ")
location = int(input("Would you like to attend the Science Centre (1), IMAX Film (2), or both (3)? "))
age = int(input("What is your age? "))
id = input("Do you have a student ID? ('y' or 'n') ")

if location == 1:
    if id == 'y':
        if age <= 2:
            print("Your cost for entry will be $0.00")
        elif age <= 17:
            print("Your cost for entry will be $13.00")
        else:   
            print("Your cost for entry will be $16.00")
    elif id == 'n':
        if age >= 65 or >= 13:
            print("Your cost for entry will be $16.00")
        elif age >= 18:
            print("Your cost for entry will be $22.00")
        elif age >= 3: 
            print("Your cost for entry will be $13.00")
        else:
            print("Your cost for entry will be $0.00")

if location == 2:
    if id == 'y':
        if age <= 2:
            print("Your cost for entry will be $0.00")  
        else:
            print("Your cost for entry will be $9.00")
    if id == 'n':
        if age <= 2:
            print("Your cost for entry will be $0.00")
        else: 
            print("Your cost for entry will be $9.00")



if location == 3:
    if id == 'y':
        print("Your cost for entry will be $22.00")
    elif id == 'n':
        if age >= 65 or >= 13:
            print("Your cost for entry will be $22.00")
        elif age >= 18:
            print("Your cost for entry will be $28.00")
        elif age >= 3: 
            print("Your cost for entry will be $19.00")
        else:
            print("Your cost for entry will be $0.00")

Keep getting this error:

Traceback (most recent call last):
  File "python", line 15
    if age >= 65 or >= 13:
                    ^
SyntaxError: invalid syntax

I tried everything but i can not see a error. I am also new to python so Im sorry if the error is easy to spot.

tdelaney
  • 73,364
  • 6
  • 83
  • 116

3 Answers3

3

You've to do it like this:

if age >= 65 or age >= 13:

Look how i had to put in the age variable before both numbers.
You should look at it in this way: that each >= returns either True or False, so if 13 is less or equal to nothing, python don't understand it, and probably aslo many other coding languages.

Marius Johan
  • 394
  • 3
  • 13
2

while the others have answered regarding the syntax, I'm curious whether you really meant age >= 65 or age >= 13 or perhaps age >= 65 or age <= 13?

If you did mean age >= 65 or age >= 13, I think age >= 13 is enough as higher than 65 is also higher than 13.

strivn
  • 309
  • 2
  • 8
1

It must be age >= 65 or age >= 13

Stévillis
  • 491
  • 1
  • 6
  • 16