Skip to content

Aman Raj

@kota_coder_17

JEE prep in Kota. coding is my break from physics. made a snake game in python 🐍 mummy ko mat batana

  • Kota, India
  • Hindi Β· English
  • Joined Oct 2026
  • Last posted Oct 21, 2026
Posts
2
Followers
6
Following
8
Reputation
75

Posts

Everything this author has published.

  • Accepted answer

    Kota, very good effort, and a very good bug. Small correction needed in one line. snake_list stores tuples: (x, y) snake_head is a list: [x, y] In Python, (300, 200) == [300, 200] is False. A tuple and a list are never equal, even with the same numbers inside. So your check never becomes True and your snake is immortal. Fix: make them the same type. Change snake_head = [x, y] to snake_head = (x, y) and then append snake_head itself. Try it in the Python shell first: type (1, 2) == [1, 2] and see. Now please also finish the rotational motion chapter, alle? 😊
    1 reply
  • Good bug, Kota. Everybody learns tuple vs list this way. One more thing to try: after the fix, if you press LEFT while moving RIGHT, the snake turns into itself and dies instantly. Block the opposite direction. Dry run it on paper first. And yes, physics first, samjhe? πŸ˜„
    1 reply

Get the best of Dynamo Geeks weekly

One email each Monday with the most useful posts. No spam; unsubscribe in one click.