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 c3c2dc7 commit bae2bba
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 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 @@ -6,3 +6,4 @@ Qua Mar 11 19:35:07 BRT 2020 - Vinicius garcia e Otavio Cardoso
Qua Mar 11 19:40:25 BRT 2020 - Otavio Cardoso e Vinicius garcia
Qua Mar 11 19:45:47 BRT 2020 - Vinicius Garcia e Otavio Cardoso
Qua Mar 11 19:58:50 BRT 2020 - Otavio Cardoso e Vinicius Garcia
Qua Mar 11 20:04:14 BRT 2020 - Vinicius Garcia e Otavio Cardoso
12 changes: 10 additions & 2 deletions 2020/20200311 - poker - python/problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ def sort_hand(hand):
if value == 'T':
card[0] = 10
elif value == 'J':
card[0] = 11
card[0] = 11
elif value == 'Q':
card[0] = 12
elif value == 'K':
card[0] = 13
else:
card[0] = int(value)

Expand All @@ -26,7 +30,11 @@ def sort_hand(hand):
if value == 10:
card[0] = 'T'
elif value == 11:
card[0] = 'J'
card[0] = 'J'
elif value == 12:
card[0] = 'Q'
elif value == 13:
card[0] = 'K'
else:
card[0] = str(value)

Expand Down
14 changes: 13 additions & 1 deletion 2020/20200311 - poker - python/test_problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,19 @@ def test_higher_card_2(self):

def test_higher_card_3(self):
hand = ['2D','3C', 'TH', 'JS', '6D']
self.assertEqual(sort_hand(hand), [ 'JS', 'TH', '6D','3C', '2D'])
self.assertEqual(sort_hand(hand), [ 'JS', 'TH', '6D', '3C', '2D'])

def test_higher_card_4(self):
hand = ['QD','3C', 'TH', 'JS', '6D']
self.assertEqual(sort_hand(hand), ['QD', 'JS', 'TH', '6D', '3C'])

def test_higher_card_5(self):
hand = ['QD','3C', 'TH', 'JS', 'KD']
self.assertEqual(sort_hand(hand), ['KD', 'QD', 'JS', 'TH', '3C'])

def test_higher_card_6(self):
hand = ['QD','AC', 'TH', 'JS', 'KD']
self.assertEqual(sort_hand(hand), ['AC', 'KD', 'QD', 'JS', 'TH'])

if __name__ == "__main__":
unittest.main()
Expand Down

0 comments on commit bae2bba

Please sign in to comment.