Cube/main.py

19 lines
556 B
Python
Raw Normal View History

2023-03-27 19:51:52 +02:00
#!/usr/bin/python3
import random
2023-03-27 20:59:54 +02:00
cube = 'Würfel-Generator\nZum Würfeln die 1 Drücken.'
print(cube.center(54))
def cube():
while True:
try:
entry = int(input('1 drücken zum Würfeln.\n'))
#entry = int(entry)
2023-03-28 12:29:16 +02:00
if entry == 1:
print(random.randint(1, 6))
elif entry > 1:
print('Ups! Da wurde nicht die 1 gedrückt. Bitte nochmal versuchen.\n')
2023-03-27 20:59:54 +02:00
except ValueError:
2023-03-28 12:29:16 +02:00
print('Ups! Da wurde nicht die 1 gedrückt. Bitte nochmal versuchen.\n')
2023-03-27 19:51:52 +02:00
2023-03-27 20:59:54 +02:00
cube()
2023-03-28 12:29:16 +02:00