Code Snippet Recursive and iterative nuggets
Now that MITx first test is over, I got feeling that this one task requested for generate and test solution is begging also for less efficient recursive solution as it is so simple. Here it is! Single liner aproved by the released grader! If you wander if you are able to buy exactly n nuggets by boxes of 6, 9 or 20 nuggets each, it tells the answer. It does not tell you how heavy your shopping bags would be and how many geeks you need to eat them ;) This recursive version can not deal with 1000000 nuggets (using …
|+0 forum 0|
Code Snippet IBAN number check refreshed
Picked up from old thread but currently applicable (the IBAN number became more widely required actually this year in Finland). The style was quite alien for modern Python coders, so I massaged the code to my own liking. I removed many temporary variables, as for my opinion they did not make things cleared, and I reformed map lambdas to generators.
|+2 forum 1|