diff options
| author | Mohammad S Anwar <Mohammad.Anwar@yahoo.com> | 2022-01-06 14:21:19 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-01-06 14:21:19 +0000 |
| commit | a3f45de7cd3ce8820a8e42ecebbe0c5031292a03 (patch) | |
| tree | 51809bfcba19b0631bf33b9586af678e5891f3e9 /challenge-002/abigail/python | |
| parent | f98a27d3409f2cfd1fdcf283e9453847520869b9 (diff) | |
| parent | 74d9830dc5dbf14456f9e4f6b15d82761224b11f (diff) | |
| download | perlweeklychallenge-club-a3f45de7cd3ce8820a8e42ecebbe0c5031292a03.tar.gz perlweeklychallenge-club-a3f45de7cd3ce8820a8e42ecebbe0c5031292a03.tar.bz2 perlweeklychallenge-club-a3f45de7cd3ce8820a8e42ecebbe0c5031292a03.zip | |
Merge pull request #5480 from Abigail/abigail/week-002
Abigail/week 002
Diffstat (limited to 'challenge-002/abigail/python')
| -rw-r--r-- | challenge-002/abigail/python/ch-1.py | 6 | ||||
| -rw-r--r-- | challenge-002/abigail/python/ch-2.py | 10 |
2 files changed, 8 insertions, 8 deletions
diff --git a/challenge-002/abigail/python/ch-1.py b/challenge-002/abigail/python/ch-1.py index de6839af0a..0c7d4ebe5d 100644 --- a/challenge-002/abigail/python/ch-1.py +++ b/challenge-002/abigail/python/ch-1.py @@ -1,14 +1,14 @@ #!/opt/local/bin/python # -# See ../READ.md +# See https://theweeklychallenge.org/blog/perl-weekly-challenge-002 # # -# Run as python ch-1.py < input-file +# Run as: python ch-1.py < input-file # import fileinput for line in fileinput . input (): - print int (line) + print (int (line)) diff --git a/challenge-002/abigail/python/ch-2.py b/challenge-002/abigail/python/ch-2.py index 22fe4fcaf0..b00e0dd541 100644 --- a/challenge-002/abigail/python/ch-2.py +++ b/challenge-002/abigail/python/ch-2.py @@ -1,11 +1,11 @@ #!/opt/local/bin/python # -# See ../READ.md +# See https://theweeklychallenge.org/blog/perl-weekly-challenge-002 # # -# Run as python ch-2.py {-f | -t} < input-file +# Run as: python ch-2.py {-f | -t} < input-file # import fileinput @@ -28,7 +28,7 @@ for opt, val in opts: do_to_base = 1 if do_to_base + do_from_base != 1: - print "Need exactly one of -f or -t" + print ("Need exactly one of -f or -t") sys . exit (1) @@ -52,7 +52,7 @@ def to_base (number): # Translate a number from base BASE to base 10 # def from_base (number): - return int (number, BASE) + return int (number . strip (), BASE) # # Need to clean argv, else fileinput will try to open a file @@ -60,4 +60,4 @@ def from_base (number): sys . argv [1:] = [] for line in fileinput . input (): - print from_base (line) if do_from_base else to_base (int (line)) + print (from_base (line) if do_from_base else to_base (int (line))) |
