bobhig

dogyears

May 23rd, 2021
639
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #calculate the number of dog years from the age of a dog
  2. #
  3. age = input('Enter the age of your dog in years ')
  4.  
  5. #convert string input to int type
  6. age_num = int(age)
  7.  
  8. #multiply by 7 to claculate dog years
  9. dog_age = age_num * 7
  10.  
  11. #convert that back to a string type ready to print
  12. dog_age_str = str(dog_age)
  13.  
  14. #print it out
  15. print('Your dog is ' + dog_age_str + ' dog years old.')
RAW Paste Data