Home /
Expert Answers /
Computer Science /
in-python-nbsp-write-the-following-functions-fill-a-rectangle-with-the-specified-color-center-pa580
(Solved): In python
Write the following functions: # Fill a rectangle with the specified color, center, ...
In python
Write the following functions: # Fill a rectangle with the specified color, center, width, and height. def drawRectangle(color= "black", x = 0, y = 0, width = 30, height = 30): # Fill a circle with the specified color, center, and radius. def drawCircle(color = "black", x = 0, y = 0, radius = 50): Write a main function that prompt the user for the parameters of function drawRectangel and call the above two functions. Here is a sample run: Enter color of the rectangle: red Enter x center of the rectangle: -100 Enter y center of the rectangle: -100 Enter width of the rectangle: 80 Enter height of the rectangle: 60 Python Turtle Graphics X >
Code: import turtle def drawRectangle(color = "black", x = 0, y = 0, width = 30, height = 40): t = turtle.Turtle() #Go to the left bottom corner of the rectangle t.color("white") #color = white, so no line is there t.forward(