> ##
> import turtle, random
>
> def checkForward(distance):
> old_position = turtle.position()
> turtle._pen.up()
> turtle.forward(distance)
> forward_failed = outOfBounds()
you set forward faile
On Sat, Oct 2, 2010 at 7:45 PM, Steve Willoughby wrote:
> On 02-Oct-10 10:32, Emile van Sebille wrote:
>>>
>>> File "my_turtle.py", line 19
>>> if (abs(turtle.position()[0])> turtle.window_height()/2) or
>>> ^
>>> SyntaxError: invalid syntax
>
> How does Python know that the next line is the conti
On 10/2/2010 10:45 AM Steve Willoughby said...
On 02-Oct-10 10:32, Emile van Sebille wrote:
Well, not really -- this is the OPs code. I was responding to Joel's
comment of not seeing the entire post.
File "my_turtle.py", line 19
if (abs(turtle.position()[0]) > turtle.window_height()/2) or
On 02-Oct-10 10:32, Emile van Sebille wrote:
File "my_turtle.py", line 19
if (abs(turtle.position()[0])> turtle.window_height()/2) or
^
SyntaxError: invalid syntax
How does Python know that the next line is the continuation of your if
statement, instead of the beginning of a new line of code?
On 10/2/2010 10:16 AM Joel Goldstick said...
##
import turtle, random
def checkForward(distance):
old_position = turtle.position()
turtle._pen.up()
# no show/hide turtle methods in my turtle modul
On Sat, Oct 2, 2010 at 12:43 PM, roberto wrote:
> On Thu, Sep 30, 2010 at 1:45 PM, ALAN GAULD wrote:
>> Copy the code into a text file with a name ending in .py - lets call it
>> myfile.py for now
>> (if you have not already done so)
>>
>> From a bash prompt type
>>
>> $ python myfile.py
>>
>> Th
On Thu, Sep 30, 2010 at 1:45 PM, ALAN GAULD wrote:
> Copy the code into a text file with a name ending in .py - lets call it
> myfile.py for now
> (if you have not already done so)
>
> From a bash prompt type
>
> $ python myfile.py
>
> Then cut n paste any error messages into an email to the list
ttp://www.alan-g.me.uk/
- Original Message
> From: roberto
> To: Alan Gauld
> Cc: tutor@python.org
> Sent: Thursday, 30 September, 2010 10:02:51
> Subject: Re: [Tutor] function error
>
> On Wed, Sep 29, 2010 at 11:13 PM, Alan Gauld
>wrote:
> >
> >
On Wed, Sep 29, 2010 at 11:13 PM, Alan Gauld wrote:
>
> OK, Thats a non standard error trace so presumably you are running it inside
> an IDE of some kind? It may be the IDE is masking the true error.
> What happens if you just execute the code from a shell prompt in a console
> window? Can you s
"roberto" wrote
Perhaps if you provide the full traceback from the error
here it is:
TypeError Traceback (most recent
call last)
~/randomMove2.py in ()
> 1
2
3
4
5
...
~/checkForward.py in out_of_bounds()
19
20 def outOfBo
>> Perhaps if you provide the full traceback from the error (assuming you're
>> still getting this >error); tracebacks generally show the offending code as
>> well. It may be something that's >simply overlooked but shows in the
>> traceback.
>>
>>
>
> here it is:
>
> TypeError
On Tue, Sep 28, 2010 at 8:26 PM, Evert Rol wrote:
>
> Perhaps if you provide the full traceback from the error (assuming you're
> still getting this >error); tracebacks generally show the offending code as
> well. It may be something that's >simply overlooked but shows in the
> traceback.
>
>
>> It seems that ur turtle.position doesn't return a list because of this when
>> indexing is done on that u get this kind of error.
>> --nitin
>
> it seemed to me that kind of error but then i found that it was a
> list, as expected:
>
> $ type(turtle.position())
> $
> $ abs(turtle.position()[
On Tue, Sep 28, 2010 at 12:35 PM, Nitin Das wrote:
> It seems that ur turtle.position doesn't return a list because of this when
> indexing is done on that u get this kind of error.
> --nitin
it seemed to me that kind of error but then i found that it was a
list, as expected:
$ type(turtle.posi
It seems that ur turtle.position doesn't return a list because of this when
indexing is done on that u get this kind of error.
--nitin
On Tue, Sep 28, 2010 at 3:39 PM, Alan Gauld wrote:
>
> "roberto" wrote
>
>
> i have the following error when i call this function:
>> 20 def outOfBounds():
>>
"roberto" wrote
i have the following error when i call this function:
20 def outOfBounds():
---> 21 if abs(turtle.position()[0]) >
turtle.window_height()/2 or abs(turtle.position()[1]) >
turtle.window_width()/2:
22 return "true"
23 else:
TypeError: 'f
hello,
i have the following error when i call this function:
20 def outOfBounds():
---> 21 if abs(turtle.position()[0]) >
turtle.window_height()/2 or abs(turtle.position()[1]) >
turtle.window_width()/2:
22 return "true"
23 else:
TypeError: 'function' ob
17 matches
Mail list logo