Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Test case #9: beer time
- time = input()
- hour = time[-8:-6]
- minutes = time[-5:-3]
- time_designator = time[-2:]
- if hour.isdigit() and minutes.isdigit() and time_designator == 'PM':
- if 1 <= int(hour) < 12:
- print('beer time')
- elif int(hour) == 12:
- print('non-beer time')
- else:
- print('invalid time')
- elif hour.isdigit() and minutes.isdigit() and time_designator == 'AM':
- if int(hour) == 12 or int(hour) == 1 or int(hour) == 2:
- if int(minutes) <= 59:
- print('beer time')
- elif int(hour) >= 3:
- print('non-beer time')
- else:
- print('invalid time')
- else:
- print('invalid time')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement