Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from random import randint as rand
- import readchar
- import msvcrt
- import keyboard
- #help(keyboard)
- language = int(input("Выберете язык 1 - Русский, 2 - Английский :"))
- endGame = False
- if language == 2 :
- print("Вводите символы которые видите на экране")
- pressedKey = None
- checkTrue = 0
- while True:
- if endGame:
- break
- kod = rand(65, 122)
- neededKey = chr(kod)
- print(neededKey, end = '', flush = True)
- pressedKey = readchar.readkey()
- if neededKey == pressedKey :
- checkTrue += 1
- while neededKey != pressedKey :
- checkTrue = 0
- print("\n")
- print("Ошибка!")
- print("\b")
- print(neededKey, end = '', flush = True)
- pressedKey = readchar.readkey()
- if neededKey == pressedKey :
- checkTrue += 1
- if keyboard.is_pressed('esc') :
- print(f"Кол-во верных ответов: {checkTrue}")
- checkTrue = 0
- endGame = True
- break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement