How to define "turtle" in Python

41 Views Asked by At

I put in a code that I had been using to make a "Pong" game. The code is from here.

I put in

# Creating the Ball
ball = turtle.Turtle()
ball.shape("circle")
ball.color("white")
import turtle

and it said

NameError: name 'turtle' is not defined

What is wrong here, and how do I fix it?

1

There are 1 best solutions below

1
jsbueno On

You need to put the import turtle line first in your code. The others should work.