Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Variable Issue
#1
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
Reply


Messages In This Thread
Variable Issue - by slackerman73 - Nov-09-2019, 04:15 PM
RE: Variable Issue - by ichabod801 - Nov-09-2019, 04:27 PM
RE: Variable Issue - by slackerman73 - Nov-09-2019, 04:34 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Commas issue in variable ddahlman 6 428 Apr-05-2024, 03:45 PM
Last Post: deanhystad
  Variable scope issue melvin13 2 1,536 Nov-29-2021, 08:26 PM
Last Post: melvin13
  Issue with affecting numbers to a variable Adem 3 2,301 Sep-24-2019, 07:48 AM
Last Post: Adem
  Mixed string,Integer input variable issue maderdash 2 2,756 Nov-06-2018, 09:46 AM
Last Post: snippsat
  Variable Resetting Issue Niicollas__ 8 4,247 Jan-20-2018, 08:52 PM
Last Post: j.crater
  netCDF issue with filling a variable HeavyLoads 1 11,478 Oct-03-2016, 08:34 PM
Last Post: micseydel

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020