2
import turtle # Allows us to use turtles
wn = turtle.Screen() # Creates a playground for turtles
alex = turtle.Turtle() # Create a turtle, assign to alex
alex.forward(50) # Tell alex to move forward by 50 units
alex.left(90) # Tell alex to turn by 90 degrees
alex.forward(30) # Complete the second side of a rectangle
wn.mainloop() # Wait for user to close window



Traceback (most recent call last):
  File "C:/Users/Zixiang Li/Documents/Zixiang6666666.py", line 1, in <module>
import turtle # Allows us to use turtles
  File "C:/Users/Zixiang Li/Documents\turtle.py", line 10, in <module>
    wn = turtle.Screen() # Creates a playground for turtles
AttributeError: module 'turtle' has no attribute 'Screen'

I tried on my PC and Mac, both not working.Can someone please help me. Thanks!!

AxeTank
  • 21
  • 2
  • Don't name your file 'turtle', python gets confused about what you're trying to import. Change the filename to something else like 'turtletest.py' or somesuch and you should be fine. – pvg May 28 '17 at 02:14
  • I named my file Zixiang6666666 not turtle. – AxeTank May 28 '17 at 02:17
  • There's a file named 'turtle.py' in the same directory as your file. That's what's getting imported, not python's built-in turtle module. – pvg May 28 '17 at 02:18
  • Might want to start by searching for the exact error, seeing as it was already asked and answered before – Novaterata May 28 '17 at 02:25

0 Answers0