Python error "'str' object has no attribute 'turtle' in Python turtle"

0 votes

I have the following python code using the module turtle:

import turtle # Import the required library

pg = turtle.Turtle
pg.shape("turtle")
pg.color(255)
pg.forward(100)
pg.backward(50)
pg.left(90)
pg.forward(200)

But I get the following error:

'str' object has no attribute 'turtle' in Python turtle
Jul 8 in Python by Yamini
20 views

1 answer to this question.

0 votes

There is a syntax error. Change the second line from:

ft = turtle.Turtle

to

ft = turtle.Turtle()
answered Jul 8 by Pallavi

Related Questions In Python

0 votes
1 answer
0 votes
1 answer

Python error "AttributeError: 'Turtle' object has no attribute 'Shape'"

Hey @Nagya, replace python.Shape("Square") with the following: python.shape("square") Python is case ...READ MORE

answered Jun 19 in Python by Faiza
50 views
0 votes
1 answer

Python error "AttributeError: 'str' object has no attribute 'casefold'"

Check your python version. Casefold is possible ...READ MORE

answered Jul 4 in Python by Yesha
47 views
0 votes
1 answer

Getting AttributeError: 'module' object (scipy) has no attribute 'misc' in Python. How to solve this?

>>> import scipy >>> scipy.misc Traceback (most recent call ...READ MORE

answered Dec 24, 2018 in Python by Nymeria
• 3,500 points
607 views
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6 in Python by Neha
• 330 points

edited Jul 8 by Kalgi 128 views
+4 votes
6 answers
0 votes
1 answer

Python Pandas error: AttributeError: 'DataFrame' object has no attribute 'rows'

There is no attribute called “rows”. The ...READ MORE

answered Mar 28 in Python by Shri
1,236 views
0 votes
1 answer

what is attribute error in python?

import pandas df = pd.read_csv('filename') it will give attribute ...READ MORE

answered Mar 27 in Python by Mohammad
• 1,500 points
82 views