Hi,

Every time I use the turtle module on Pycharm Edu 4. I keep getting an error for every turtle function I use. The ide tells me "cannot find … in turtle.py. "

I imported the turtle module at the start of the code. I installed and use Python 3 on my computer. I don’t know why I keep getting this error. There are not spelling mistakes or anything I can see. Please help.

Thanks. Much appreciated.

can you please copy paste your code to the forum so we can actually run it?

this makes it much easier for us to find the issue

2 Likes

Heres the source code.

```
# Turtle: plot the sine function
import turtle
import math
turtle.speed(0) # Fastest
# Draw X-axis
turtle.penup()
turtle.goto(-220, 0)
turtle.pendown()
turtle.goto(220, 0)
# Draw arrows
turtle.degrees()
turtle.setheading(150)
turtle.forward(20)
turtle.penup()
turtle.goto(220, 0)
turtle.pendown()
turtle.setheading(-150)
turtle.forward(20)
# Draw Y-axis
turtle.penup()
turtle.goto(0, -80)
turtle.pendown()
turtle.goto(0, 80)
turtle.penup()
turtle.goto(0, 80)
turtle.pendown()
turtle.setheading(240)
turtle.forward(20)
turtle.penup()
turtle.goto(0, 80)
turtle.pendown()
turtle.setheading(-60)
turtle.forward(20)
# Draw sine funciton
x = -175
turtle.penup()
turtle.goto(x, 50 * math.sin((x / 100.0) * 2 * math.pi))
turtle.pendown()
for x in range(-175, 176):
turtle.goto(x, 50 * math.sin((x / 100) * 2 * math.pi))
turtle.penup()
turtle.goto(-100, -15)
turtle.pendown()
turtle.write("-2\u03c0")
turtle.penup()
turtle.goto(100, -15)
turtle.pendown()
turtle.write("2\u03c0")
turtle.hideturtle()
turtle.done()
```

1 Like

this is the result of running the program on my computer:

and here i ran the code:

https://repl.it/OAT4

but that is python2, this code does not get the angles right in python2, but in both versions of python its working

so, slightly baffled where it goes wrong in your case

2 Likes

It runs perfectly on my computer. But I was just wondering why the Pycharm Edu 4 ide gives me this error.

1 Like

python, pycharm

an easy google search seems to yield the desired result

2 Likes

system
closed
November 18, 2017, 9:02am
#7
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.