Question: Write a Python program that draws different shapes. First, write a function drawLine(length) that takes an input parameter number, length, and draws one line of

 Write a Python program that draws different shapes. First, write afunction drawLine(length) that takes an input parameter number, length, and draws one

Write a Python program that draws different shapes. First, write a function drawLine(length) that takes an input parameter number, length, and draws one line of stars where the number of stars is equal to the input number length. The function definition starts as follows: def draw Line(length) This function will be used in the program that you write to draw shapes. Write a program that draws one of three shapes depending on the user's choice: a square, a rectangle or triangle. Your program will prompt the user to enter their choice of shape: 's' for Square, for rectangle, and t for triangle. If a user enters a character that is not 's', 'r' or 't, the program should display a message indicating that the user's choice was an incorrect type of shape. If the user enters a valid choice, your program will prompt the user to enter the size of the shape. This will be the length of the side of the square, both the length of the across" side and length of the "down" side for the rectangle, or the length of the side of a right triangle. Implement a function to draw each shape and your program will call one of the three functions depending on the shape the user chose. Your program must be general enough to draw shapes of different sizes. However, you can assume that the sizes given by the user will be greater than 0 def drawSquare size) def drawRectangle across size, down size) def drawTriangle(size)

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!