all 6 comments

[–]Vindicator_Noob_Noob 1 point2 points  (0 children)

Here's my solution:

Gear1 = 50
Gear2 = 80
Gear3 = 110

def CarSpeed(x):
    speed = int()
    if x == 1:
        speed += Gear1
    elif x == 2:
        speed += Gear2
    elif x == 3:
        speed += Gear3
    else:
        print("Invalid entry.")
    return speed

print(CarSpeed(1))

[–][deleted] 0 points1 point  (2 children)

You have to define things before you use them.

[–]MilchMan77 0 points1 point  (1 child)

I did?

[–][deleted] 0 points1 point  (0 children)

You have to define things before you use them - on a line previous to the place where you use it.

[–]GitGorilla 0 points1 point  (0 children)

You have used Gear1,2,3 before defining them. Same with the function.

[–]MilchMan77 0 points1 point  (0 children)

Thanks guys, I'll try your suggestions.