The climbing stairs puzzle
Edit in new window
bubble
play_circle
Run
stop_circle
Stop
cancel
Clear
text_increase
text_decrease
light_mode
routine
dark_mode
restart_alt
Reset
download_for_offline
Download
help
Help
main.py
+
#The climbing stairs puzzle - www.101computing.net/the-climbing-stairs-puzzle def countWays(n): if n==1: return 1 elif n==2: return 2 else: return countWays(n-1) + countWays(n-2) steps = 10 ways = countWays(steps) print("There are " + str(ways) + " distinct ways to climb a staircase of " + str(steps) + " steps when climbing up one or two steps at a time.")
task_alt