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)
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()
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.