| about | help | code help+videos | done | prefs |
darts_doubleout_named
One more take at the darts problem. This time, we will introduce the rule that the final, winning dart must be a double. Since it is now harder to figure out how to win, define the function darts_doubleout_named(total) to return a string naming the darts if there is a way to reach total with the last dart being a double, and return None if there is no such way. If there are multiple ways, choose the way that first has the fewest number of darts, and second is in the highest numeric order (highest dart first, etc.). darts_doubleout_named(117) → 'T20 T17 D3' darts_doubleout_named(170) → 'T20 T20 DB' darts_doubleout_named(160) → 'T20 T20 D20' ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 602 Post-solution available
Copyright Nick Parlante 2017 - privacy