0
What's wrong with my code? Poker Hand challenge in Python, failing test cases 5 and 6
It seems that case 6 is supposed to be a Straight Flush, but my code isn't getting it right. No clue what case 5 is. https://code.sololearn.com/cWhLI382Tq1p/?ref=app
2 ответов
+ 1
Hard to be sure but it looks like your logic for straight (and for royal flush) assumes that hand[0] is the lowest value card, but the problem doesn't guarantee that for your input and you didn't sort the list.
0
Woah, you're right! Adding the following line to sort the list by card value made it work:
hand.sort(key=lambda x: values.index(x[0:-1]))
Thanks!