Advertisement
Adehumble

Week2 Coding Exercise 3

Feb 7th, 2020
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.52 KB | None | 0 0
  1. #3
  2. #The following lines of codes DEMONSTRATES THIS EXERCISE by returning the product of the ages of a child and his/her two parents.
  3.  
  4. def multiplier(num1=1, num2=1, num3=1):
  5.     return(num1*num2*num3)
  6.  
  7. #Here, i also use float to format the input data type, in case the user supplied a float number.
  8.  
  9. Age1=int(float(input("How old are you? ")))
  10. Age2=int(float(input("Enter your Father's age ")))
  11. Age3=int(float(input("Enter your Mum's age ")))
  12. print("The product of your ages is: ", end=" ")
  13. print(multiplier(Age1*Age2*Age3))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement