Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Hours = input('Enter the current hour: ')
- Minutes = input('Enter the current minute: ')
- if int(Hours) > 12 or int(Hours) < 1:
- Hours = input('You entered an incorrect value for Hours. Please, try again: ')
- if int(Minutes) > 60 or int(Minutes) < 0:
- Minutes = input('You entered an incorrect value for Minutes. Please, try again: ')
- if int(Hours) > 12 or int(Hours) < 1:
- Hours = 1
- if int(Minutes) > 60 or int(Minutes) < 0:
- Minutes = 0
- AMPM = input('Please enter AM or PM: ')
- if AMPM == "Am" or AMPM == "am":
- AMPM = "AM"
- if AMPM == "Pm" or AMPM == "pm":
- AMPM = "PM"
- if AMPM is not "AM" or AMPM is not "PM":
- AMPM = input('You entered an incorrect value for AMPM. Please, try again: ')
- if AMPM == "Am" or AMPM == "am":
- AMPM = "AM"
- if AMPM == "Pm" or AMPM == "pm":
- AMPM = "PM"
- if AMPM is not "AM" or AMPM is not "PM":
- AMPM = "AM"
- Runclock = 1
- Seconds = 0
- Display = 0
- import time
- while Runclock == 1:
- Seconds = int(Seconds) + 1
- if Seconds == 60:
- Seconds = 0
- Minutes = int(Minutes) - 1
- if Minutes == 60:
- Minutes = 0
- Hours = Hours + 1
- if Hours == 13:
- Hours = 1
- if Hours == 12 and Seconds == 0 and AMPM == 'AM':
- AMPM = PM
- if Hours == 12 and Seconds == 0 and AMPM == 'PM':
- AMPM == AM
- time.sleep(1)
- Display = ('') + repr(AMPM) + (' H=') + repr(Hours) + (' M=') + repr(Minutes) + (' S=') + repr(Seconds)
- print(Display)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement