diff options
| author | Mohammad S Anwar <Mohammad.Anwar@yahoo.com> | 2021-02-20 01:18:05 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-20 01:18:05 +0000 |
| commit | 2102fa481829f30d4e6ec37d04fa77f87e7e9a50 (patch) | |
| tree | 158db5e61a8ba4e27e57b0feb52c6673a65af476 /challenge-100/paulo-custodio/python/ch-1.py | |
| parent | 468bc290d602b49bc9c51d8905d7e389e931806e (diff) | |
| parent | 798c5692eb4c43474a1ba230bb93f9fdfc3fd311 (diff) | |
| download | perlweeklychallenge-club-2102fa481829f30d4e6ec37d04fa77f87e7e9a50.tar.gz perlweeklychallenge-club-2102fa481829f30d4e6ec37d04fa77f87e7e9a50.tar.bz2 perlweeklychallenge-club-2102fa481829f30d4e6ec37d04fa77f87e7e9a50.zip | |
Merge pull request #3576 from pauloscustodio/paulo-custodio
Paulo Custodio
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()) |
