diff options
Diffstat (limited to 'challenge-100/paulo-custodio/python/ch-1.py')
| -rw-r--r-- | challenge-100/paulo-custodio/python/ch-1.py | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/challenge-100/paulo-custodio/python/ch-1.py b/challenge-100/paulo-custodio/python/ch-1.py index 12fad2210b..818624d76b 100644 --- a/challenge-100/paulo-custodio/python/ch-1.py +++ b/challenge-100/paulo-custodio/python/ch-1.py @@ -1,16 +1,14 @@ #!/usr/bin/env python -# Challenge 100 -# # TASK #1 > Fun Time # Submitted by: Mohammad S Anwar # You are given a time (12 hour / 24 hour). -# +# # Write a script to convert the given time from 12 hour format to 24 hour format # and vice versa. -# +# # Ideally we expect a one-liner. -# +# # Example 1: # Input: 05:15 pm or 05:15pm # Output: 17:15 @@ -23,8 +21,8 @@ import sys; import datetime; if re.search(r'am|pm', sys.argv[1], re.I): - t = datetime.datetime.strptime(sys.argv[1], "%I:%M%p") - print(t.strftime("%H:%M")) + t = datetime.datetime.strptime(sys.argv[1], "%I:%M%p") + print(t.strftime("%H:%M")) else: - t = datetime.datetime.strptime(sys.argv[1], "%H:%M") - print(t.strftime("%I:%M%p").lower()) + t = datetime.datetime.strptime(sys.argv[1], "%H:%M") + print(t.strftime("%I:%M%p").lower()) |
