i trying execute following:
print("are old enough vote? please enter age below:") input() age = 18 if age < 18: print('you must 18 vote.') elif age >= 18: print ('you of voting age.') when run it, program prints "you of voting age" no matter how low number input is.
because assigning age fixed variable , never changing user input.
age = 18 then,
if age >= 18: will execute code block.
you need assign age input().
you like:
age_string = input() if age_value.isdigit(): # number age = int(age_string) then execute if/then statement.
Comments
Post a Comment