Python Forum
Variable Issue - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Variable Issue (/thread-22345.html)



Variable Issue - slackerman73 - Nov-09-2019

Hello - I'm very new to python and working on a simple voting program where it asks what the user's age is. If they are 18 or older it will print "You're of voting age. If they're not 18, it will print "You must be 18 to vote. See my code below.
voter_age = int(input('How old are you?'))
If voter_age <= 18:
    Print ('You are of voting age.')
else:
   Print('You must be 18 to vote.')
There is something wrong with my variable voter_age. I get an error on line 2 when I run the program. Any help is appreciated.

Slackerman


RE: Variable Issue - ichabod801 - Nov-09-2019

If and Print should not be capitalized. Python is case sensitive. Most of the base Python functions and statements will be lowercase.

Also, check you indentation on line 5. Whatever indentation you use, it should be consistent throughout the program.


RE: Variable Issue - slackerman73 - Nov-09-2019

That was it! OMG, I can't believe it. I sat here looking at that for over 20 minutes and couldn't find anything wrong with what I had written. I'll definitely keep on the lookout for case in the future. Thanks so much.