diff options
| author | user-person <60802990+user-person@users.noreply.github.com> | 2020-03-29 13:28:43 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-03-29 13:28:43 -0400 |
| commit | 57d5bc206530efe100646a8d60b0fe379235b569 (patch) | |
| tree | 556084e7f547beff3634b11e0477aa78e716ec20 /challenge-052/user-person/python/ch-1.py | |
| parent | f5c036d0eeb77b3dacfd9b2f42916e2fe7b7399b (diff) | |
| parent | 606470083c840a68f73eff57bf7668ebd169c2a6 (diff) | |
| download | perlweeklychallenge-club-57d5bc206530efe100646a8d60b0fe379235b569.tar.gz perlweeklychallenge-club-57d5bc206530efe100646a8d60b0fe379235b569.tar.bz2 perlweeklychallenge-club-57d5bc206530efe100646a8d60b0fe379235b569.zip | |
Merge branch 'master' into branch-for-challenge-053
Diffstat (limited to 'challenge-052/user-person/python/ch-1.py')
| -rwxr-xr-x | challenge-052/user-person/python/ch-1.py | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/challenge-052/user-person/python/ch-1.py b/challenge-052/user-person/python/ch-1.py index 5c3d2f019d..98b642394d 100755 --- a/challenge-052/user-person/python/ch-1.py +++ b/challenge-052/user-person/python/ch-1.py @@ -2,7 +2,6 @@ ########################################################################### # script name: ch-1.py # -# Tue Mar 17 20:39:07 2020 | 1584491947 # # # # https://github.com/user-person # # # @@ -26,15 +25,26 @@ 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:]] for arg in args: |
