Question: Write a Python function named draw_star that takes an integer as input, which represents how many rows you will draw. This function will print out

 Write a Python function named draw_star that takes an integer as

Write a Python function named draw_star that takes an integer as input, which represents how many rows you will draw. This function will print out a pyramid of stars. Ask the user to input row number (Hint: use input() function) and call the function to print out the stars. Please test the other row numbers, such as row = 3 or 5, 6, Hint: You need to use a nested loop for this problem. Each line is consisting of three parts, a certain number of spaces (one inner loop) followed by a certain number of stars (another inner loop), and then followed by a new line. You need to find out how many spaces and how many stars for each line i and generate each using a loop. Fill in the table below and find the f(i,n) will help you to find the stop condition of each loop. Where i is line number and n is user input. Read the example in the lecture slides if you have difficulty. line i number of Spaces fi,n)=? number of stars f(in)=? 1 4 1 2 3 3 3 2 5 4 1 7 5 0 9 Please input the row number: 15 * * * + * * * >>>

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!