return code error python

Solutions on MaxInterview for return code error python by the best coders in the world

showing results for - "return code error python"
Aaliyah
25 Sep 2018
1from turtle import*
2from random import randrange
3from freegames import square, vector
4
5food = vector(0,0)
6snake = [vector(10,0)]
7aim = vector(0,-10)
8def change(x,y):
9  aim.x=x
10  aim.y=y
11
12def inside(head):
13    return -200<head.x<190 and -200 <head.y <190
14def move():
15        head=snake[-1].copy()
16        head.move(aim)
17
18        if not inside(head) or head in snake:
19            square(head.x,head.y,9,'red')
20update()
21
22a
23return
24
25snake.append()
26print('snake',len(snake))
27if head==food: food.x = randrange(-15,15)*10
28food.y = randrange(-15,15)*10
29
30else
31snake.pop(0)
32
33clear()
34
35for body in snake:
36    square(body.x,body.y,9,'green')
37
38    square(food.x,food.y,9,'red')
39    update()
40    ontime(move, 100)
41
42hideturtle()
43tracer(False)
44listen()
45onkey(lambda:changes(10,0),'right')
46onkey(lambda:changes(-10,0),'left')
47onkey(lambda:changes(0,10),'up')
48onkey(lambda:changes(0,-10),'down')
49
50move()
51done()
Vincent
07 Feb 2016
1File "c:\Users\deoll\Desktop\java\python test\pythontest.py", line 30
2    else
3    ^
4SyntaxError: invalid syntax
5PS C:\Users\deoll\Desktop\java>