A negative loop pushes a level towards a set point. A positive loop multiplies a level in each cycle. You will write one step of each loop and then run them.
The idea. In the negative loop, each step adds times the gap between the set point and the level. In the positive loop, each cycle multiplies the level by .
Your tasks.
negative_step. It gives the new level after one step.settle. It starts at start, applies negative_step the given number of times and gives the final level.cycles_to. It counts the cycles of the positive loop until the level is at least need.Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…