aboutsummaryrefslogtreecommitdiff
path: root/challenge-052/user-person/python
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-052/user-person/python')
-rwxr-xr-xchallenge-052/user-person/python/ch-1.py18
-rwxr-xr-xchallenge-052/user-person/python/ch-2.py7
2 files changed, 17 insertions, 8 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:
diff --git a/challenge-052/user-person/python/ch-2.py b/challenge-052/user-person/python/ch-2.py
index 0431509ebc..da402bb7db 100755
--- a/challenge-052/user-person/python/ch-2.py
+++ b/challenge-052/user-person/python/ch-2.py
@@ -2,7 +2,6 @@
###########################################################################
# script name: ch-2.py #
-# Thu Mar 19 14:51:04 2020 | 1584643864 #
# #
# https://github.com/user-person #
# #
@@ -70,7 +69,7 @@ def playerChoice():
takeCoin( 'f', 'player')
continue
- fl = input()
+ fl = input('> ')
if fl == 'f' or fl == 'l':
takeCoin( fl, 'player')
@@ -123,7 +122,7 @@ while len(coins):
if bank['computer'] > bank['player']:
print('Computer Wins. Computer: L ' + '{:.2f}'.format(bank['computer']) \
- + ' Player: L ' + '{:.2f}'.format(bank['player']))
+ + ' Player: L ' + '{:.2f}'.format(bank['player']) + '\n')
else:
print('Player Wins. Player: L ' + '{:.2f}'.format(bank['player']) \
- + ' Computer: L ' + '{:.2f}'.format(bank['computer']))
+ + ' Computer: L ' + '{:.2f}'.format(bank['computer']) + '\n')