Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 used36Step 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