Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use Pascal Triangle Template on python: Print Pascal's triangle by adding code to the given template file. Print the triangle up to row 6. Please

Use Pascal Triangle Template on python:

image text in transcribed

Print Pascal's triangle by adding code to the given template file. Print the triangle up to row 6. Please make sure that the program can run. Thank you.

This is what it should look like.

image text in transcribed

Also, this is what I have and I'm new to programming, but I keep getting an error on line 8, so if you could help me correct it and explain what had happened, or find a more reasonable solution Id appreciate it.

def pascal_triangle(n): line = [1] a = [] for i in range(n): a.append([]) a[i].append(1) for j in range(1,i): a[i].append(a[i-1][j-1]+a[i-1][j]) if(n>1): a[i].append(1) line = a[n-1] print (line) return line pascal_triangle (6)

def pascal triangle (n): line [1] # Put your code here print (line) return line pascal triangle (6)

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

Recommended Textbook for

SQL Server Query Performance Tuning

Authors: Sajal Dam, Grant Fritchey

4th Edition

1430267429, 9781430267423

More Books

Students also viewed these Databases questions

Question

2 Find all invertible elements in 72 330

Answered: 1 week ago

Question

What is the Definition for Third Normal Form?

Answered: 1 week ago

Question

Provide two examples of a One-To-Many relationship.

Answered: 1 week ago