Question: 1. Write recursive function, q1(n), that takes a non-negative integer as input and returns a list of numbers as described below. For 0 through 5,
1. Write recursive function, q1(n), that takes a non-negative integer as input and returns a list of numbers as described below. For 0 through 5, q1 produces:
>>> q1(0) [] >>> q1(1) [1] >>> q1(2) [1, 4, 1] >>> q1(3) [1, 4, 1, 9, 1, 4, 1] >>> q1(4) [1, 4, 1, 9, 1, 4, 1, 16, 1, 4, 1, 9, 1, 4, 1] >>> q1(5) [1, 4, 1, 9, 1, 4, 1, 16, 1, 4, 1, 9, 1, 4, 1, 25, 1, 4, 1, 9, 1, 4, 1, 16, 1, 4, 1, 9, 1, 4, 1]
1. Write recursive function, qi(n), that takes a non-negative integer as input and returns a list of numbers as described below. For 0 through 5, q1 produces: >>> 91(0) [] >>> 91(1) [1] >>> 21(2) [1, 4, 1] >>> 21(3) [1, 4, 1, 9, 1, 4, 1] >>> 91(4) [1, 4, 1, 9, 1, 4, 1, 16, 1, 4, 1, 9, 1, 4, 1] >>> 91(5) [1, 4, 1, 9, 1, 4, 1, 16, 1, 4, 1, 9, 1, 4, 1, 25, 1, 4, 1, 9, 1, 4, 1, 16, 1, 4, 1, 9, 1, 4, 1]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts

