Menu

(Solved) : 1 Pascal S Triangle Infinite Two Dimensional Pattern Numbers Whose First Six Lines Alterna Q29409193 . . .

1. Pascals triangle is an infinite two-dimensional pattern of numbers whose first six lines are alternate formatting (may be helpful for code) usual formatting 1 1235 1 331 1 4641 1 5 10 10 5 1 1 4641 1 5 10 10 5 1 The first line, line 0, contains just 1. All other lines start and end with a 1 as well. The other numbers in those lines are obtained using the following rule: the number at position j is the sum of the numbers in position i-1 and ? in the previous line. Implement a recursive function ascalLine takes as a parameter a non-negative integer n and returns a list containing the sequence of numbers appearing in the nth line of Pascals Triangle. The function will have one loop in it to construct the list corresponding to the line returned, but the rest of the work should be done recursively. The following shows some sample runs of the function: >>> pascalline (0) >>> pascalline (1) >>>pascalLine (2) >>>pascalLine (3) >>> pascalline (4) >>>pascalLine (7) [1, 7, 21, 35, 35, 21, 7, 1]

1. Pascal’s triangle is an infinite two-dimensional pattern of numbers whose first six lines are alternate formatting (may be helpful for code) usual formatting 1 1235 1 331 1 4641 1 5 10 10 5 1 1 4641 1 5 10 10 5 1 The first line, line 0, contains just 1. All other lines start and end with a 1 as well. The other numbers in those lines are obtained using the following rule: the number at position j is the sum of the numbers in position i-1 and ? in the previous line. Implement a recursive function ascalLine takes as a parameter a non-negative integer n and returns a list containing the sequence of numbers appearing in the nth line of Pascal’s Triangle. The function will have one loop in it to construct the list corresponding to the line returned, but the rest of the work should be done recursively. The following shows some sample runs of the function: >>> pascalline (0) >>> pascalline (1) >>>pascalLine (2) >>>pascalLine (3) >>> pascalline (4) >>>pascalLine (7) [1, 7, 21, 35, 35, 21, 7, 1] Show transcribed image text

Expert Answer


Answer to 1 Pascal S Triangle Infinite Two Dimensional Pattern Numbers Whose First Six Lines Alterna Q29409193 . . .

OR