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