samedi 7 mars 2020

Unable to change the value of a variable in python, if-statement

I have a very simple script, the goal is that if someone enters a number between 40 and 49 for raw_input, the value of ageRisk should change from 0 to 0.004

age = raw_input("Enter your age: ")

ageRisk = 0

if age >= 40 and age < 50:
    ageRisk = 0.004

print ageRisk

However when I run this script entering 44 for the raw_input, the value for ageRisk remains at 0. Why is this?

Aucun commentaire:

Enregistrer un commentaire