Skip to content

Commit

Permalink
Vinicius garcia e Otavio Cardoso
Browse files Browse the repository at this point in the history
  • Loading branch information
dojorio committed Mar 11, 2020
1 parent 753f906 commit 54ba3de
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 19 deletions.
1 change: 1 addition & 0 deletions 2020/20200311 - poker - python/dojo.log
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ Qua Mar 11 20:04:14 BRT 2020 - Vinicius Garcia e Otavio Cardoso
Qua Mar 11 20:09:30 BRT 2020 - Otavio Cardoso e Vinicius Garcia
Qua Mar 11 20:15:22 BRT 2020 - Vinicius Garcia e Otavio Cardoso
Qua Mar 11 20:21:01 BRT 2020 - Otavio Cardoso e Vinicius Garcia
Qua Mar 11 20:28:38 BRT 2020 - Vinicius garcia e Otavio Cardoso
24 changes: 5 additions & 19 deletions 2020/20200311 - poker - python/problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@ def hand_value(hand):
return 'carta-alta'

def sort_hand(hand):
splited = []
values = {
'T': 10, 'J': 11, 'Q': 12, 'K': 13, 'A': 14
}

for card in hand:
splited.append(list(card))
splited = [list(card) for card in hand]

for card in splited:
value = card[0]
Expand All @@ -26,22 +24,10 @@ def sort_hand(hand):

for card in splited:
value = card[0]
if value == 10:
card[0] = 'T'
elif value == 11:
card[0] = 'J'
elif value == 12:
card[0] = 'Q'
elif value == 13:
card[0] = 'K'
elif value == 14:
card[0] = 'A'

if value in values:
card[0] = values[value]
else:
card[0] = str(value)

result = []

for card in splited:
result.append(card[0]+card[1])

return result[::-1]
return [''.join(card) for card in splited[::-1]]

0 comments on commit 54ba3de

Please sign in to comment.