- 1
Poker Hand - Code Coach, failed 1 test case.
Hi guys, I hope anyone out there can help me with my code. It failed 1 test case, and also hoping that someone can suggest improving my code. Thanks a lot. https://code.sololearn.com/c9wF99kgkAHa/?ref=app
5 odpowiedzi
+ 4
cards2 = sorted(cards)
But at line 21 it's str not int so list sorts like ['10',..,'9'] and gives a problem with "Straight Flush"
+ 1
only pro subscriber can see the test case
+ 1
I couldn't find the problem, but I can suggest some improvements:
1. Use better variable (and function, class, etc.) names. It's quite easier to follow the logic when the names make sense.
2. Use loops for repetitive tests, instead of a big "or" stream.
3. Create functions to help on those tests, like repetition counters, sequence detectors, etc.
+ 1
Thank you Julia Shabanova!
0
Thank you Emerson Prado!