[Solved]Modify Program Create Triangle Replace Square Function Calls Random Pattern Program Triang Q37117376
Modify the program below to create a triangle. Replace thesquare function calls in the random pattern program with thetriangles function call. You will need to enter the code from belowand modify the square function to implement a triangle. Finalsoftware should include these functions in files:
polygons.py ; triangle , hexagon , radialhexagons, radialpattern
randompatterns.py ; drawPattern , main
Dont forget the turtle.cfg file


#File polygons.py def square (t, length) # Draws a square with the given length for count in range (4): t.forward (length) t.left (90) def hexagon (t, length): # Draws a hexígon with the given length for count in range (6) t.forward (length) t.left (60) def radialHexagons (t, n, length) # Draws a radial pattern of n hexagons with the given length for count in range (n): hexagon (t, length) t left (360 / n) def radialpattern (t, n, length, shape) # Draws a radial pattern of n shapes with the given length for count in range (n): shape (t, length) t left (360 / n) ile: randompatters pY Daraws a radial pattern of squars in a random fill color at each order of the window from turtle import Turtle from polygons import import random def drawPattern (t, x, y, count, length, shape): Draws a radial pattern with a random fill color at the given position t.begin_fill () t.up () t.goto (x,y) t.setheading (0) t.down () t.screen.colormode (255) t.fillcolor (random.randint (0, 255), random.randint (0, 255), random.randint (0, 255)) radialpattern (t, count, length, shape) t.end fill () def main t Turtle () t.speed (0) # Number of shapes in radial pattern count-10 # Relative distances to corners of window from center width – t.screen.window width ) /I 2 height -t.screen.window height () I/ 2 # Length of the square length -30 # Inset distance from window boundary for squares inset length 2 # Draw squares in upper-left corner drawPattern (t, -width + inset, height – inset, count, length, sqquare) # Draw squares in lower-left corner drawPattern (t, -width + inset, inset – height, count, length, sqquare) # Length of the hexagon length-20 # Inset distance from window boundary for hexagons inset-length 3 # Draw hexagons in upper-right corner drawPattern (t, width-inset, height-inset, count, length, hexagon) # Draw hexagons in lower-right corner drawPattern (t, width-inset, inset-height, count, length, hexagon) if name ” main”: main () turtle – Notepad File Edit Format View Help width = 300 height200 using IDLE = T colormode-25!5 rue Show transcribed image text #File polygons.py def square (t, length) # Draws a square with the given length for count in range (4): t.forward (length) t.left (90) def hexagon (t, length): # Draws a hexígon with the given length for count in range (6) t.forward (length) t.left (60) def radialHexagons (t, n, length) # Draws a radial pattern of n hexagons with the given length for count in range (n): hexagon (t, length) t left (360 / n) def radialpattern (t, n, length, shape) # Draws a radial pattern of n shapes with the given length for count in range (n): shape (t, length) t left (360 / n)
ile: randompatters pY Daraws a radial pattern of squars in a random fill color at each order of the window from turtle import Turtle from polygons import import random def drawPattern (t, x, y, count, length, shape): Draws a radial pattern with a random fill color at the given position t.begin_fill () t.up () t.goto (x,y) t.setheading (0) t.down () t.screen.colormode (255) t.fillcolor (random.randint (0, 255), random.randint (0, 255), random.randint (0, 255)) radialpattern (t, count, length, shape) t.end fill () def main t Turtle () t.speed (0) # Number of shapes in radial pattern count-10 # Relative distances to corners of window from center width – t.screen.window width ) /I 2 height -t.screen.window height () I/ 2 # Length of the square length -30 # Inset distance from window boundary for squares inset length 2 # Draw squares in upper-left corner drawPattern (t, -width + inset, height – inset, count, length, sqquare) # Draw squares in lower-left corner drawPattern (t, -width + inset, inset – height, count, length, sqquare) # Length of the hexagon length-20 # Inset distance from window boundary for hexagons inset-length 3 # Draw hexagons in upper-right corner drawPattern (t, width-inset, height-inset, count, length, hexagon) # Draw hexagons in lower-right corner drawPattern (t, width-inset, inset-height, count, length, hexagon) if name ” main”: main ()
turtle – Notepad File Edit Format View Help width = 300 height200 using IDLE = T colormode-25!5 rue
Expert Answer
Answer to Modify the program below to create a triangle. Replace the square function calls in the random pattern program with the … . . .
OR

