Jan-26-2018, 12:12 PM
(This post was last modified: Jan-26-2018, 12:14 PM by pancit_canton.)
Hello, everybody....I am new to this forum...And definitely very new in programming, ANYTHING....I have these few lines of code on the if, elif...just seven lines, I think...no matter what I do it evaluates to 'false' or 'sorry, you're not qualified to vote'. I've tried modifying the variables, to just one key, two values (age = 20,21) it still evaluates to false...somebody said there has to be a variable when getting input...I tried that...still no way...then somebody said that this is a python quirk, where python will only evaluate zero (0) as false, and everything else is evaluated to true...that just sounds a little off to me, and I don't wanna buy that .... yet.
I hope somebody from y'all can slap my head with a washing paddle and show me what I'm doing wrong....
Thanks a lot...
Here's the source code:
And if it's any help, I use both the 2.7 and 3.6 versions.
Thanks again.
Pancit Bihon
PS : I've also tried this way, still no way...
your_age= 20
your_age=21
input('please indicate your_age. ')
if your_age <= 20:
print('sorry. you are not yet qualified to vote.')
elif your_age >=21:
print ('good. please proceed to the voting booth.')
This gives the 'good. please proceed...' response whichever age is indicated.
I hope somebody from y'all can slap my head with a washing paddle and show me what I'm doing wrong....
Thanks a lot...
Here's the source code:
your_age= 20 your_age=21 input('please indicate your_age. ') if 20: print('sorry. you are not yet qualified to vote.') elif 21: print ('good. please proceed to the voting booth.')Whichever age I input, the answer comes back "sorry, you're not yet qualified to vote".
And if it's any help, I use both the 2.7 and 3.6 versions.
Thanks again.
Pancit Bihon
PS : I've also tried this way, still no way...
your_age= 20
your_age=21
input('please indicate your_age. ')
if your_age <= 20:
print('sorry. you are not yet qualified to vote.')
elif your_age >=21:
print ('good. please proceed to the voting booth.')
This gives the 'good. please proceed...' response whichever age is indicated.