Question: Using Python 3.6.4: Using Recursion: 10.29: Pascals triangle is an infinite two-dimensional pattern of numbers whose first five lines are illustrated in Figure 10.16. The

Using Python 3.6.4:

Using Recursion:

10.29:

Pascals triangle is an infinite two-dimensional pattern of numbers whose first five lines are illustrated in Figure 10.16. The first line, line 0, contains just 1. All other lines start and end with a 1 too. The other numbers in those lines are obtained using this rule: The number at position i is the sum of the numbers in position i 1 and i in the previous line.

Using Python 3.6.4: Using Recursion: 10.29: Pascals triangle is an infinite two-dimensional

Implement recursive function pascalLine() that takes a nonnegative integer n as input and returns a list containing the sequence of numbers appearing in the nth line of Pascals triangle. >>> pascalLine(0)

[1]

>>> pascalLine(2)

[1, 2, 1]

>>> pascalLine(3)

[1, 3, 3, 1]

>>> pascalLine(4)

[1, 4, 6, 4, 1]

4 1 3 3 1 1 4 6 41 15 10 10 5 1 8 16 32 6 1520 15 6164 17 21 35 35 21 7 1 128

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!