diff options
| author | southpawgeek <jen@southpawgeek.com> | 2020-04-11 23:14:40 -0400 |
|---|---|---|
| committer | southpawgeek <jen@southpawgeek.com> | 2020-04-11 23:14:40 -0400 |
| commit | f48b90c7646261151f0511de9cdbb0bfa11cfbdc (patch) | |
| tree | 7d1fcc8457cd1f330ad0b2a81d0191baf7537b2b /challenge-052/user-person/python | |
| parent | 0e9109efb139ec71d1cec0db145d336b104409a0 (diff) | |
| parent | 3e3892a127e0393baed83fc53fbf8523ce9f20e7 (diff) | |
| download | perlweeklychallenge-club-f48b90c7646261151f0511de9cdbb0bfa11cfbdc.tar.gz perlweeklychallenge-club-f48b90c7646261151f0511de9cdbb0bfa11cfbdc.tar.bz2 perlweeklychallenge-club-f48b90c7646261151f0511de9cdbb0bfa11cfbdc.zip | |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'challenge-052/user-person/python')
| -rwxr-xr-x | challenge-052/user-person/python/ch-1.py | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/challenge-052/user-person/python/ch-1.py b/challenge-052/user-person/python/ch-1.py index b7a0685098..2cb2de3814 100755 --- a/challenge-052/user-person/python/ch-1.py +++ b/challenge-052/user-person/python/ch-1.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 ########################################################################### -# script name: ch-1.py # +# script name: ch-1-CORRECTED.py # # # # https://github.com/user-person # # # @@ -25,17 +25,28 @@ step = [] UPPER_LIMIT = 1000 LOWER_LIMIT = 99 -for i in range(1,8): - step.append( (i * 100) + ((i+1) * 10) + (i+2) ) +for i in range(1,10): + if i < 8: # UP UP + step.append( (i * 100) + ((i+1) * 10) + (i+2) ) + + if i > 1: # DOWN DOWN + step.append( (i * 100) + ((i-1) * 10) + (i-2) ) + + if i < 9: # UP DOWN + step.append( (i * 100) + (i+1) * 10 + i ) + + step.append( (i * 100) + (i-1) * 10 + i ) # DOWN UP + +step.sort() errorString = os.path.basename(sys.argv[0]) + ' requires 2 arguments between 100 and 999.' if len(sys.argv) != 3: print(errorString) exit(1) - -args = [int(arg) for arg in sys.argv[1:]] +args = [int(arg) for arg in sys.argv[1:]] + for arg in args: if arg < LOWER_LIMIT or arg > UPPER_LIMIT: print(errorString) |
