Question

Enter an integer: 3125 F e The reversed number is 5213 Sections 3.7-3.8 **3.12 (Turtle: raw a star) Write a program that prompts the user to enter the length of the star and draw a star, as shown in Figure 3.5a. (Hint: The inner angle of each point in the star is 36 degrees.) Python Turtle Graphic STOP (a) (e) FIGURE 3.5 The program (a draws a star, (b) displays a STOP sign, and (c) draws an olympic symbol. *3.13 Curtle: display a sTOP ign) write a program that displays a STOP sign, as shown in Figure 3.5b. The hexagon is in red and the text is in white. 3-14 CTurtle: draw the olympic symbol write a program that prompts the user to enter the radius of the rings and draws an olympic symbol of five rings of the same size with the colors blue, black, red, yellow, and green. as shown in Figure 3.5c. *3.15 Turtle: paint a smiley face) write a program that paints a smiley face, as shown in Figure 3.6a. Please help with 3.12 and 3.14
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Python code for olympic rings :

import turtle
class MyTurtleOly(turtle.Turtle):
""""""

def __init__(self):
""" Constructor"""
turtle.Turtle.__init__(self, shape="turtle")

  
def drawCircle(self, x, y, radius=50):
"""
Moves the turtle to draw a circle
"""
self.penup()
self.setposition(x, y)
self.pendown()
self.circle(radius)


def drawOlympicSymbol(self):
"""
Iterates to draw the Olympics logo
"""
positions = [(0, 0), (-120, 0), (60,60),
(-60, 60), (-180, 60)]
for position in positions:
self.drawCircle(position[0], position[1])

if __name__ == "__main__":
t = MyTurtleOly()
t.drawOlympicSymbol()
turtle.getscreen()._root.mainloop()


Python code for star :

import turtle
def drawStar(size, color):
angle = 120
turtle.fillcolor(color)
turtle.begin_fill()

for side in range(5):
turtle.forward(size)
turtle.right(angle)
turtle.forward(size)
turtle.right(72 - angle)
turtle.end_fill()
return

drawStar(100, "purple")

Add a comment
Know the answer?
Add Answer to:
Please help with 3.12 and 3.14 Write a program that prompts the user to enter the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT