Replace the basic summation example with a simple simulation of coin-… #637
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue #636:Examples / exercises encourage anti-patterns in 12-for-loops.md
Replace the example somewhat heavy-handed summation over a loop variable with a simulation of coin tosses:
range
starting from zero with spurious additions in a loop, just userange
properly. 3) A trivial summation over the loop variable should be done with the built-insum
function.Imports have been introduced previously, so it's probably okay to use random.random()
Other examples in the episode use if statements, but this is just more justification to switch the conditionals and loops episodes; conditionals are more fundamental than loops, if you don't have conditional branches, you're not Turing-Complete, and you don't really have a language.
Delete the string revering exercise.
On branch loops_grg
modified: episodes/12-for-loops.md