I entered "import turtle" instead of "from turtle import * ", but it looks as 
if it did not import the pendown command. Why is that?

import turtle

def drawSquare(size=100):
    turtle.pendown
    turtle.forward(size)
    turtle.left(90)
    turtle.forward(size)
    turtle.left(90)
    turtle.forward(size)
    turtle.left(90)
    turtle.forward(size)
    turtle.left(90)

drawSquare(50)

input ()

Traceback (most recent call last):
  File "/Users/Hershel/PycharmProjects/Project 1/practicefornotturtle.py", line 
14, in <module>
    drawSquare(50)
  File "/Users/Hershel/PycharmProjects/Project 1/practicefornotturtle.py", line 
4, in drawSquare
    turtle.pendown
AttributeError: 'module' object has no attribute 'pendown'

Process finished with exit code 1


Begin forwarded message:

> From: Alan Gauld via Tutor <tutor@python.org>
> Date: June 19, 2016 1:47:44 AM MST
> To: tutor@python.org
> Subject: Re: [Tutor] Fwd: Turtle
> Reply-To: Alan Gauld <alan.ga...@yahoo.co.uk>
> 
> On 19/06/16 04:46, Hershel Millman wrote:
> 
>>> In pycharm, when I enter the following, it replies with the following error 
>>> message:
>>> 
>>> from turtle import *
>>> 
> 
> Change that to
> 
> import turtle
> 
> and it should work.
> 
> 
> 
>>> def drawSquare(size=100):
>>>   turtle.pendown()
>>>   turtle.forward(size)
>>>   turtle.left(90)
>>>   turtle.forward(size)
>>>   turtle.left(90)
>>>   turtle.forward(size)
>>>   turtle.left(90)
>>>   turtle.forward(size)
>>>   turtle.left(90)
>>> 
>>> drawSquare(50)
>>> 
>>> input ()
> 
> 
> -- 
> Alan G
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
> http://www.amazon.com/author/alan_gauld
> Follow my photo-blog on Flickr at:
> http://www.flickr.com/photos/alangauldphotos
> 
> 
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to