Stair-climbing puzzle: Difference between revisions
Content added Content deleted
(Added Wren) |
Alextretyak (talk | contribs) m (→Iterative) |
||
Line 1,006: | Line 1,006: | ||
=== Iterative === |
=== Iterative === |
||
<lang python>def step_up1() |
<lang python>def step_up1(): |
||
"Straightforward implementation: keep track of how many level we |
"""Straightforward implementation: keep track of how many level we |
||
need to ascend, and stop when this count is zero." |
need to ascend, and stop when this count is zero.""" |
||
deficit = 1 |
deficit = 1 |
||
while deficit > 0: |
while deficit > 0: |