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