- 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

25th Oct 2022, 4:09 PM
Cris Tradio
Cris Tradio - avatar
5 Answers
+ 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"
25th Oct 2022, 9:14 PM
Julia Shabanova
Julia Shabanova - avatar
+ 1
only pro subscriber can see the test case
25th Oct 2022, 5:40 PM
Sunil Shrestha
Sunil Shrestha - avatar
+ 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.
25th Oct 2022, 6:59 PM
Emerson Prado
Emerson Prado - avatar
+ 1
Thank you Julia Shabanova!
26th Oct 2022, 1:57 AM
Cris Tradio
Cris Tradio - avatar
0
Thank you Emerson Prado!
26th Oct 2022, 1:57 AM
Cris Tradio
Cris Tradio - avatar