Advertisement
Guest User

Untitled

a guest
Nov 11th, 2017
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. #Special Date
  2. print("The date February 10, 2020 is special because when it is written in the following format the month times the day equals the year : 2/10/20.")
  3.  
  4. #Inputs
  5. while True:
  6. try:
  7. userInputMonth = int(input("Please enter a valid month:"))
  8. except ValueError:
  9. print("Please provide a numeric input for the month. Try again...")
  10. try:
  11. userInputDay = int(input("Please enter a valid day:"))
  12. except ValueError:
  13. print("Please provide a numeric input for the day:")
  14. try:
  15. userInputYear = int(input("Please enter a valid two-digit-year:"))
  16. except ValueError:
  17. print("Please provide a numeric input for the year.")
  18.  
  19. print()
  20.  
  21. if userInputMonth * userInputDay == userInputYear:
  22. print("The date you provided " + str(userInputMonth) + "/" + str( userInputDay) + "/" + \
  23. str(userInputYear) + " is the special date.")
  24. else:
  25. print("The date you provided " + str(userInputMonth) + "/" + str(userInputDay) + "/" + \
  26. str(userInputYear) + " is not the special date.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement