Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In Python 3 Pascals triangle rules: 1. To generate the triangle, you start from the first row, which is always 1, and the second row

In Python 3

Pascals triangle rules: 1. To generate the triangle, you start from the first row, which is always 1, and the second row which is always 1 1.

2. After the first two rows, each row at level h is generated from the values at row h-1. Note that the leftmost number and the rightmost number in any row are always 1. Note that, in row h, there are h numbers.

Part 1 (A) Write a function named make_new_row that takes one argument old_row and generates the next row of Pascals triangle (starting with old_row = [1,1]).

def make_new_row(old_row): """Requires: -- list old_row that begins and ends with a 1 and has zero or more integers in between (has to have at least [1,1]) Returns: -- list beginning and ending with a 1 and each interior (non 1) integer is the sum of the corresponding old_row elements For example if old_row = [ 1,4,6,4,1], then new_row = [1,5,10,10,5,1], i.e. 5=1+4, 10=4+6, 10=6+4, 5=4+1 """

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

5. What information would the team members need?

Answered: 1 week ago

Question

Where those not participating, encouraged to participate?

Answered: 1 week ago