Question: Write a Python program (draw_shapes.py) that uses functions to draw a triangle, a square, or all two shapes, as chosen by the user. Your program

Write a Python program (draw_shapes.py) that uses functions to draw a triangle, a square, or all two shapes, as chosen by the user.

Your program should contain three functions:

(1) draw_triangle(num): This function takes in an integer as a parameter, and draws a solid right-angle triangle (made of asterisks) of that height and width. This function should have no return statement. (Submit for 3 points)

(2) draw_square(num): This function takes in an integer as a parameter, and draws a solid square (made of asterisks) of that height and width. This function should have no return statement. (Submit for 3 points)

(3) __main__: In the main, you do the following:

a. Gets a positive integer (greater than 0) as an input from the user. Reprompt until the user enters a positive integer greater than 0.

b. Asks the user to choose which shape: triangle, square, or all to select all two shapes. Reprompt until the user enters a valid choice.

c. Calls the appropriate function(s) to print what the user requested. (Submit for 4 points)

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!