Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

How do I create the picture with the circles in python? I\'m probably not doing

ID: 3872674 • Letter: H

Question

How do I create the picture with the circles in python? I'm probably not doing this right, but this is what I have so far:

from graphics import *
from math import *

def main():
win = GraphWin("Sphere Plot", 320, 320)
win.setBackground("white")
win.setCoords(0.0, -5.0, 0.0, 5.0)
  

.2 Use the following Python graphics module colors colors [red, orange, yellow, green, lightskyblue, navy,violet, blackj. The circles all have radi of 1. The x coordinates of the circles centers are given by 0,2*sqrt(2),4,2*sqrt(2),0,-2*sqrt(2),-4,-2*sqrt(2)). The y coordinates of the circles center are given by { 4, 2*sqrt(2),0,-2*sqrt(2-4,- 2*sqrt(2),0,2*sqrt(2). The limits of the plot are-5 to 5 in the x and y direction. Submit a Python module lastnamelab4.py to Canvas that produces this plot.

Explanation / Answer

'''
here it is you find answer
the n is the no of pixels
you can change it if you want
'''

from graphics import *
from math import *

def main():
win = GraphWin("Sphere Plot",320,320)
win.setBackground("white")
win.setCoords(-100,-100,100,100)

n=15
  
circ1 = Circle(Point(n*0,n*4),n)
circ2 = Circle(Point(n*2*sqrt(2),n*2*sqrt(2)),n)
circ3 = Circle(Point(n*4,n*0),n)
circ4 = Circle(Point(n*2*sqrt(2),n*(-2*sqrt(2))),n)
circ5 = Circle(Point(n*0,n*(-4)),n)
circ6 = Circle(Point(n*(-2*sqrt(2)),n*(-2*sqrt(2))),n)
circ7 = Circle(Point(n*(-4),0),n)
circ8 = Circle(Point(n*(-2*sqrt(2)),n*2*sqrt(2)),n)

circ1.setFill('red')
circ1.draw(win)
circ2.setFill('orange')
circ2.draw(win)
circ3.setFill('yellow')
circ3.draw(win)
circ4.setFill('green')
circ4.draw(win)
circ5.setFill('lightskyblue')
circ5.draw(win)
circ6.setFill('navy')
circ6.draw(win)
circ7.setFill('violet')
circ7.draw(win)
circ8.setFill('black')
circ8.draw(win)

input('Press <Enter> to quit.')
win.close()
  

main()

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote