Ask coding questions

← Back to all posts
No Attribute to turtle.pen()

I have a program that worked 100% in the actual python 3.6, but here it doesn't work at all. The program stops at the second line, because apparently turtle.Pen() isn't real. This is the beginning of the code. Any suggestions to fix the problem? BTW, I am using the turtle environment.

import turtle

skull_is_dull (40)

if you are trying to make the turtle called t you need to type t = turtle.Turtle()

John_WardWard (247)

What you are doing wrong is that you have not assigned t to anything. To make the turtle "t" use t=turtle.Turtle() rather than t=turtle.Pen().

Geocube101 (566)

If your trying to set t to a turtle object, try t = turtle.Turtle()