jeudi 15 octobre 2020

Basic Python - can't get IF statement to work when comparing hardcoded int variable with dynamic int variable via input() [duplicate]

Anyone know why the below always triggers the "else" statement even when I provide age of 16?

age_to_drive = 16

print("Hello! So you want a car? Hmmmm let's get some info first.")
age = input("How old are you? ")

print(age)

if age == age_to_drive:
    print("Here's the keys to your brand new car!")
else:
    print("Sorry, you're a child!")

Aucun commentaire:

Enregistrer un commentaire