0

code error

age = input("How old are you?") if age >= 21: print("You can buy a handgun") elif age < 21: print("You cant buy a handgun") I get a error of unorderable types

8th Oct 2016, 3:06 AM
anon
2 Antworten
+ 5
age is a string because it is gotten from input. by default, input always gives a string, so you have to convert it. age = int(input("age? "))
8th Oct 2016, 4:04 AM
Luke Armstrong
- 2
Here is the right code, check out your mistakes age = input("How old are you?: ") if age >= 21: print("You can buy a handgun") elif age < 21: print("You cant buy a handgun")
8th Oct 2016, 9:15 AM
POZEIDON Thomas
POZEIDON Thomas - avatar