A simple interactive bingo game with text to speech output in Python 3. Tested with Python 3.8.10.
To install and run:
python3 -m venv .venv
. .venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt
python bingo.py
from gtts import gTTS | |
from playsound import playsound | |
from random import randint as r | |
language = 'de' | |
numbers = [] | |
def emit(): | |
i = r(0, 30) | |
if i in numbers: | |
emit() | |
else: | |
tts = gTTS(text=str(i), | |
lang=language, | |
slow=False) | |
tts.save("zahl.mp3") | |
playsound("zahl.mp3") | |
print(f'The new number is {i}.') | |
numbers.append(i) | |
print(f'All numbers: {numbers}.\n') | |
print('\n#####################\n') | |
print('# Welcome to BINGO! #\n') | |
print('#####################\n') | |
while True: | |
try: | |
print('> Return to get the next number.\n> CTRL + C to quit game.') | |
input() | |
except KeyboardInterrupt: | |
print('\n###################################') | |
print('# Thanks for playing and goodbye! #') | |
print('###################################') | |
import sys | |
sys.exit(0) | |
emit() |
certifi==2022.12.7 | |
charset-normalizer==3.0.1 | |
click==8.1.3 | |
gTTS==2.3.1 | |
idna==3.4 | |
pkg_resources==0.0.0 | |
playsound==1.3.0 | |
requests==2.28.2 | |
urllib3==1.26.14 |