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
Step: 1
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