Share your repls and programming experiences

← Back to all posts
Python Code (Snake)
NathanielCS

Hi my name is Nathanial and I have made this python code for my computer science teacher to see andI have made this very very well in my opinion if you want to see the Half of other code below here then feel free to do so:

if head.direction != "left":
head.direction = "right"

def move():
if head.direction == "up":
y = head.ycor()
head.sety(y + 20)

Keyboard bindings

wn.listen()
wn.onkeypress(go_up, "w")
wn.onkeypress(go_down, "s")
wn.onkeypress(go_left, "a")
wn.onkeypress(go_right, "d")

Main game loop

while True:
wn.update()

wn.mainloop()

Voters
Yek
Dominicl645
NathanielCS