Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a function that can return the first row of Pascal's triangle. Pascal's triangle is an arithmetic and geometric figure first imagined by Blaise Pascal.
Write a function that can return the first row of Pascal's triangle. Pascal's triangle is an arithmetic and geometric figure first imagined by Blaise Pascal. Your function can be def PasTri(n): where "n" is the number of row that we want to have in the output. Figure below shows the structure of a Pascal's triangle. 1 1 21 13 31 146 141 As you can see in the image, each number is the two numbers above it added together except the numbers in on the edge of the triangle where all of them are one. Note: To answer this question, you have to use zip function. Your function will get the n from input and print the numbers till the row number "n" as it is shown below: PasTri(6) [1] [1, 1] [1, 2, 1] [1, 3, 3, 1] [1, 4, 6, 4, 1) [1, 5, 10, 10, 5, 1] Programmed by Stew Dent. Date: Tue Feb 2 17:15:22 2021 End of processing
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started