import turtle # Create a turtle Screen screen = turtle.Screen() # Create a turtle object square = turtle.Turtle() # Move the turtle object forward by 100 units square.forward(100) # Turn the turtle object by 90 degrees square.right(90) # Move the turtle object forward by 100 units square.forward(100) # Turn the turtle object by 90 degrees square.right(90) # Move the turtle object forward by 100 units square.forward(100) # Turn the turtle object by 90 degrees square.right(90) # Move the turtle object forward by 100 units square.forward(100) # Exit the turtle Screen when clicked screen.exitonclick()
import turtle # Create a turtle Screen screen = turtle.Screen() # Create a turtle object polygon = turtle.Turtle() # Prompt the user to input the number of sides for the polygon num_sides = int(input("Enter the number of sides for the polygon: ")) # Calculate the angle between each side angle = 360 / num_sides # Draw the polygon for i in range(num_sides): polygon.forward(50) polygon.right(angle) # Exit the turtle Screen when clicked screen.exitonclick()The package library for Python turtle Screen is the turtle module in Python's standard library.