Skip to content

Instantly share code, notes, and snippets.

@sdruskat
Created February 3, 2023 11:21
Show Gist options
  • Save sdruskat/86dd15914e785e18d7e842bacb80520d to your computer and use it in GitHub Desktop.
Save sdruskat/86dd15914e785e18d7e842bacb80520d to your computer and use it in GitHub Desktop.
A very simple bingo game (0-30) with speech output (in German)

Simple bingo

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment