Advertisement
Guest User

Untitled

a guest
May 21st, 2017
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. Hours = input('Enter the current hour: ')
  2. Minutes = input('Enter the current minute: ')
  3.  
  4. if int(Hours) > 12 or int(Hours) < 1:
  5. Hours = input('You entered an incorrect value for Hours. Please, try again: ')
  6. if int(Minutes) > 60 or int(Minutes) < 0:
  7. Minutes = input('You entered an incorrect value for Minutes. Please, try again: ')
  8.  
  9. if int(Hours) > 12 or int(Hours) < 1:
  10. Hours = 1
  11. if int(Minutes) > 60 or int(Minutes) < 0:
  12. Minutes = 0
  13.  
  14. AMPM = input('Please enter AM or PM: ')
  15.  
  16. if AMPM == "Am" or AMPM == "am":
  17. AMPM = "AM"
  18. if AMPM == "Pm" or AMPM == "pm":
  19. AMPM = "PM"
  20.  
  21. if AMPM is not "AM" or AMPM is not "PM":
  22. AMPM = input('You entered an incorrect value for AMPM. Please, try again: ')
  23.  
  24. if AMPM == "Am" or AMPM == "am":
  25. AMPM = "AM"
  26. if AMPM == "Pm" or AMPM == "pm":
  27. AMPM = "PM"
  28.  
  29. if AMPM is not "AM" or AMPM is not "PM":
  30. AMPM = "AM"
  31.  
  32. Runclock = 1
  33. Seconds = 0
  34. Display = 0
  35.  
  36. import time
  37.  
  38. while Runclock == 1:
  39.  
  40. Seconds = int(Seconds) + 1
  41.  
  42. if Seconds == 60:
  43. Seconds = 0
  44. Minutes = int(Minutes) - 1
  45.  
  46. if Minutes == 60:
  47. Minutes = 0
  48. Hours = Hours + 1
  49.  
  50. if Hours == 13:
  51. Hours = 1
  52.  
  53. if Hours == 12 and Seconds == 0 and AMPM == 'AM':
  54. AMPM = PM
  55. if Hours == 12 and Seconds == 0 and AMPM == 'PM':
  56. AMPM == AM
  57.  
  58. time.sleep(1)
  59. Display = ('') + repr(AMPM) + (' H=') + repr(Hours) + (' M=') + repr(Minutes) + (' S=') + repr(Seconds)
  60. print(Display)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement