Question: Please use Python hw6 part3.py (WARNING: This part of the homework is the most challenging, so budget plenty of time and brain power.) (Worth 16
Please use Python


hw6 part3.py (WARNING: This part of the homework is the most challenging, so budget plenty of time and brain power.) (Worth 16 points) The last program will use recursion to generate the levels of Pascal's triangle You should read the Wikipedia page for information about Pascal's triangle, paying special attention to how the triangle is constructed. The program must contain a main) and a recursive function called pascal, implemented as described in the function header comment given below. (You should include this function header comment in your own code.) # pascal() uses recursion to create each level of Pascal's triangle, reaching the requested height currLevel; levelsToMake; an int, the number of levels requested levelList; # Input: an int, the current level being created a 2D list of ints, containing the levels as they are created # Output: None (leve!List is changed in place, and the updated levelList will be the same in main O Your code must perform basic input validation to ensure that numbers are greater than or equal to 1, and tell the user what it will accept as valid input Think carefully about what your base cases should be! Also, note that the code should follow the conventional numbering of a Pascal's triangle: the first row (the single 1 at the top) is row zero, meaning that a request for a triangle of height 5 will result in six rows being generated in total It is also highly recommended that you create a Pascal's triangle by hand (to a height of at least 8), paying attention to the steps taken as you go, prior to beginning your code (You do not need to worry about printing out a "centered" triangle the numbers being left-aligned (as seen in the sample output) is acceptable.) See the next page for sample output.) CMSC 201 - Computer Science I for Majors Page 5
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
