title: Creating an age calculator using python by calculating current year - birth year
body: <p>I've looked all over stack overflow and so I really need help. I'm making a program that is supposed to calculate the age of a person by asking for their birth year, validating their birth year is correct, as in a whole number, and not words or any other invalid types of answers. And then subtracting the birth year from our current year. I'm having trouble with the inputting our current year and subtracting the user input birth year from it. </p>
  
  <pre><code>    # Function Boolean is_valid_integer(String input_string)
      #   Declare Boolean is_valid
      #
      #   is_valid = is input_string a valid integer?
      #   Return is_valid
      # End Function
  
      def is_valid_integer(input_string):
          try:
              val = int(input_string)
              is_valid = True
          except ValueError:
              is_valid = False
          return is_valid
  
      # Function Integer get_year_born()
      #   Declare Boolean is_valid
      #
      #   Display "What year were you born in? "
      #   Input input_string
      #   Set is_valid = is_valid_integer(input_string)
      #   While Not is_valid
      #       Display "Please only enter whole years."
      #       Input input_string
      #       is_valid = is_valid_integer(input_string)
      #   End While
      #   input_integer = int(input_string)
      #   Return input_integer
      # End Function
  
      def get_year_born():
          input_string = input("What year were you born in? ")
          is_valid = is_valid_integer(input_string)
          while not is_valid:
              input_string = input("Please only enter whole years. ")
              is_valid = is_valid_integer(input_string)
          input_integer = int(input_string)
          return input_integer
  
      # Function Integer calculate_difference()
      #   difference = 2017 - input_integer
      # End Function
  
      import datetime
      def calculate_difference(difference):
          difference = 2017 - input_integer
          return difference
  
  
  
      # Module calculate_age_year()
      #   Set born = get_year_born()
      #   Call calculate_difference()
      # End Module
  
      def calculate_difference():
          print("Your age is: ", difference)
  
      calculate_age_year()
  </code></pre>
  
  <p>After trying to import datatime into my coding, it didn't work well. I was also not looking to calculate specific days and/or time, and so I removed those part of the suggested coding, maybe that had something to do with it? </p>
  
  <p>My purpose for this program is really to just calculate years, so if I'm born in 2000, I'd like the program to calculate from 2017, meaning I'd be 17 years old as of right now. </p>
  
  <p>My first function is the loop to void out false inputs, the second function is to get the year the user was born in, the third function is supposed to be calculating the difference between the current date and the user's birth date, and the fourth function outputting the user's actual age. </p>