Question: Question 5: Pascal Triangle (4 points) The following figure shows the first few rows of a graphic known as Pascal's triangle. 1 331 1 5


Question 5: Pascal Triangle (4 points) The following figure shows the first few rows of a graphic known as Pascal's triangle. 1 331 1 5 10 10 51 1 6 20 15 6 1 1 721 35 35 271 The triangle may be constructed in the following manner: In row 0 (the topmost row), there is a unique nonzero entry 1. Each entry of each subsequent row is constructed by adding the number above and to the left with the number above and to the right, treating blank entries as 0. For example, the initial number in the first (or any other) row is 1 (the sum of 0 and 1), whereas the numbers 1 and 3 in the third row are added to produce the number 4 in the fourth row. See https:llen wikipedia.org/wiki/Pascal's_triangle for details Write a function pascal_triangle(n) that takes as input a non-negative integer n and returns the n -th row of Pascal's triangle as a list. See the test cases for examples See the test cases for examples. In def pascal_triangle(n): # Your code here H In [ In [ : pascal_trianle(1)[1, 10, 45, 120, 210, 252, 210, 120, 45, 10,1] In [ J: pascal_triangle(15)-[1, 15, 105, 455, 1365, 3003, 5005, 6435, 6435, 505, 3003, 1365, 455, 105,15,1] In [ J: pascal_triangle(71)- [1, 71, 2485, 57155, 971635, 13019909, 143218999, 13298907e5, 10639125640, 74473879480, 461738052776, 2560547 ]: pascal-triangle(5) 5, 10, 10, 5, 1]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
