diff options
| author | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2020-03-25 18:37:50 +0000 |
|---|---|---|
| committer | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2020-03-25 18:37:50 +0000 |
| commit | f9ddd281b0676717a06f9457acfb53a69b0edec5 (patch) | |
| tree | ddfe47f3c26946129252e001a1714573cb140930 /challenge-052/user-person/python/ch-1.py | |
| parent | d4b7675ea2e5d93cd5cd8a4a2fd3fa2e8c4b5899 (diff) | |
| download | perlweeklychallenge-club-f9ddd281b0676717a06f9457acfb53a69b0edec5.tar.gz perlweeklychallenge-club-f9ddd281b0676717a06f9457acfb53a69b0edec5.tar.bz2 perlweeklychallenge-club-f9ddd281b0676717a06f9457acfb53a69b0edec5.zip | |
- Tidied up solutions by User Person.
Diffstat (limited to 'challenge-052/user-person/python/ch-1.py')
| -rwxr-xr-x | challenge-052/user-person/python/ch-1.py | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/challenge-052/user-person/python/ch-1.py b/challenge-052/user-person/python/ch-1.py index b7a0685098..98b642394d 100755 --- a/challenge-052/user-person/python/ch-1.py +++ b/challenge-052/user-person/python/ch-1.py @@ -25,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: |
