Python 3.12 Beginner Tutorial - Lesson 20 - Snake

preview_player
Показать описание
Lesson 20 - Snake

If you're using 𝗟𝗶𝗻𝘂𝘅 or 𝗠𝗮𝗰𝗢𝗦, make these changes to the code:
1 - Replace 'from msvcrt import kbhit, getch', with 'import curses'.
2 - Replace 'system('cls')' with 'system('clear')'.
3 - Replace the get_pressed_key() function with
def get_pressed_key():
converter = {119: 'w', 97: 'a', 115: 's', 100: 'd'}
try:
finally:
return key

Рекомендации по теме
Комментарии
Автор

Did everything exactly as instructed and it never ran right at first I had six errors due to indentations and even after fixing them it never created the board or anything.

jothompson
Автор

Working from a mac. "import msvcrt" is a Windows DLL. Working on changing the mod.

shaoliniumumbique
Автор

i messed up a couple of times so i had to rewatch the video multiple times but works on windows 👍

# #
# #
# #
# sss #
# S s #
# #
# s #
# s f#
# s #
# s #
# s #
# s #
# s #
# #
# #
# #
# #
# #
# #
# #

Score 216
Game Over

Mookieman
visit shbcf.ru