| about | help | code help+videos | done | prefs |
If you did the "darts" problem, you might have found yourself thinking "57? -- oh yeah, that's a triple 19". In this exercise, you will write a function so that darts_named(117) returns a readable string, "T20 T19", rather than a list of three numbers. I recommend that you do this by copying your definition of the function darts and leaving it unchanged. You would then call darts(117), get the result [60, 57, 0], and transform that to "T20 T19". The number 25 is represented as "B" (bullseye), 50 as "DB" (double bullseye), a double as "D" followed by the number (e.g. 28 is "D14"), and a triple as "T" followed by the number (e.g. 57 is "T19"), and a single as itself (e.g. 20 is "20"). 0 is ignored. darts_named(117) → 'T20 T19' darts_named(62) → 'T20 2' darts_named(501) → 'T20 T20 T20' ...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: 601 Post-solution available
Copyright Nick Parlante 2017 - privacy