In: Computer Science
Here is the completed code for this problem. Comments are included, go through it, learn how things work and let me know if you have any doubts or if you need anything to change. If you are satisfied with the solution, please rate the answer. Thanks
Note: Please maintain proper code spacing (indentation), just copy the code part and paste it in your compiler/IDE directly, no modifications required.
#code
import turtle ''' method to draw a logo for a company with name=text this method draws a logo something resembling sun & rays or giant wheels ''' def drawLogo(t, text): #pen up t.up() #using yellow as fill color (use any color you want) t.fillcolor('yellow') #start filling t.begin_fill() #drawing and filling a circle with radius 50 t.circle(50) #finish fill t.end_fill() #turning left 90 degrees t.left(90) #moving forward 50 spaces. turtle is now at the center of the circle t.forward(50) #pen down t.down() #using orange as pen color t.pencolor('orange') #looping for 20 times for i in range(20): #moving forward 100 spaces, to draw a line from center to edge t.forward(100) #drawing a 10px dot at the end t.dot(10) #moving back 100 spaces t.backward(100) #moving right 360/20 degrees (360 divided by number of points) t.right(360/20) #pen up t.up() #moving down 150 spaces t.backward(150) #writing company name t.write(text, align='center', font=('Arial', 20)) #creating a turtle t=turtle.Turtle() #max speed t.speed(0) #drawing a logo, change 'COMPANY NAME' to anything you like drawLogo(t,'COMPANY NAME') #hiding turtle and finishing off t.ht() turtle.done()
#OUTPUT