Question: use python Tree Recursion Practice 4 - You want to go up a flight of stairs that has n steps. You can either take 1
Tree Recursion Practice 4 - You want to go up a flight of stairs that has n steps. You can either take 1 or 2 steps each time. How many different ways can you go up this flight of stairs? Write a function count_stair_ways that solves this problem. Assume n is positive. Before we start, what's the base case for this question? What is the simplest input? What do count_stair ways(n-1) and count stair_ways(n - 2) represent? Use those two recursive calls to write the recursive case: def count_stair_ways (n): def repeat return else: return return
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
