Write a function makePoly(x,y,n,l) that receives a coordinate
point (x,y), an integer n representing the desired number of sides
(3 to 20) , and an integer l between 10 and 200 pixels, inclusive,
representing the length of each side. The function will then use
the turtle to draw the requested n-sided polygon at the designated
(x,y) coordinate, having sides of length l. Be sure to reject
arguments that do not conform to the restrictions given.
(Hint: to get a turtle to go somewhere, use
turtleName.goto(x,y)) python
import turtle """ Program to draw a polygon of side (3, 20) and length 10 to 200 pixels """ # import turtle def makePoly(x: int, y: int, n: int, l: int): # create Turtle() object and move turtle t to x, y co-ordinate t = turtle.Turtle() t.penup() t.goto(x, y) t.pendown() for i in range(n): # for loop iterates till n # move turtle to the length of l # find degree by the formula 360 / n # rotate the turtle by the specified angle t.forward(l) degree = 360 / n t.left(degree) turtle.done() # makePoly(10, 10, 3, 100) # makePoly(100,100,4, 100) # makePoly(100,100,5, 100) # makePoly(100,100,6, 100) makePoly(100,100,7, 100)
Write a function makePoly(x,y,n,l) that receives a coordinate point (x,y), an integer n representing the desired...
Suppose there are two non-empty list variables of equal length in Python called coords and sides. The variable coords contains sub-lists of size 2, with each of these values representing an x and a y co-ordinate. The variable sides also contains sub-lists of size 2, with each of these values representing firstly the length thern the width of a rectangle. Also assume there is also a function in Python called draw_rectangle which takes as its parameters two integers representing firstly...
Please write a code in python! Define and test a function named posterize. This function expects an image and a tuple of RGB values as arguments. The function modifies the image like the blackAndWhite function, but it uses the given RGB values instead of black. images.py import tkinter import os, os.path tk = tkinter _root = None class ImageView(tk.Canvas): def __init__(self, image, title = "New Image", autoflush=False): master = tk.Toplevel(_root) master.protocol("WM_DELETE_WINDOW", self.close) tk.Canvas.__init__(self, master, width = image.getWidth(), height = image.getHeight())...