Question: Question:Exercise 4: Write some code 9. Write a function named pyramid that (1) takes a positive integer n as a formal parameter, (2) draws a
Question:Exercise 4: Write some code 9. Write a function named pyramid that (1) takes a positive integer n as a formal parameter, (2) draws a pyramid of height n using *", as illustrated below for n = 3, 6, and (3) returns the number of symbols used. Use a for loop in the function. Call the function three times with n = 3, 6, 15 to test it one at a time. The caller must print the height of the pyramid and the number of *" used below each pyramid .
Exercise 4: Write some code 9. Write a function named pyramid that (1) takes a positive integer n as a formal parameter, (2) draws a pyramid of height n using *", as illustrated below for n = 3,6, and (3) returns the number of symbols used. Use a for loop in the function. Call the function three times with n 3,6,15 to test it one at a time. The caller must print the height of the pyramid and the number of"*" used below each pyramid. Height of pyramid- 3 Number of symbols used- 8 Height of pyramid-6 Number of symbols used36
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
