title: Maths with Ternary Boolean in Python
body: <p>I wrote this little script to calculate dog years. The first two dog years are 10.5 human years and all other years following are worth 4.</p>
  
  <pre><code>human_age = int(input("Enter the human age to convert it to doggy years: "))
      valid = (human_age &lt;=2)
      def convert_to_dog_years(human_age):
          if valid:
              dog_years = human_age * 10.5
              print('Dog age is:', int(dog_years))
          elif not valid:
              dog_years = ((((human_age - 2) * 4) + 21))
              print('Dog age is:', int(dog_years))
      convert_to_dog_years(human_age)
  </code></pre>
  
  <p>I was thinking something more along those lines:
  I would like to specify the mathematical operations giving them two names one for numbers from 0-2 and the other from 2 and up.
  Then I would like to use a boolean to decide which math process I want to apply.</p>
  
  <p>Is this possible in python?</p>
  
  <pre><code>0-2    = dog_years = human_age * 10.5
  &gt;=2    = dog_years = ((((human_age - 2) * 4) + 21))
  
  human_age = int(input("Enter the human age to convert it to doggy years: "))
  valid = (human_age &lt;=2)
  def convert_to_dog_years(human_age):
      if valid 0-2 else 2&amp;up
          print('Dog age is:', int(dog_years))
  convert_to_dog_years(human_age)
  </code></pre>