2023-03-27 19:51:52 +02:00
|
|
|
#!/usr/bin/python3
|
|
|
|
import random
|
2023-03-28 18:59:38 +02:00
|
|
|
import os
|
|
|
|
|
|
|
|
cube = 'Würfel-Generator\n'
|
2023-03-27 20:59:54 +02:00
|
|
|
print(cube.center(54))
|
|
|
|
def cube():
|
|
|
|
while True:
|
|
|
|
try:
|
2023-03-28 18:59:38 +02:00
|
|
|
entry = int(input('1 drücken zum Würfeln.\n2 drücken zum beenden.\n'))
|
|
|
|
|
2023-03-28 12:29:16 +02:00
|
|
|
if entry == 1:
|
2023-03-28 18:59:38 +02:00
|
|
|
os.system("clear")
|
2023-03-28 12:29:16 +02:00
|
|
|
print(random.randint(1, 6))
|
2023-03-28 18:59:38 +02:00
|
|
|
elif entry == 0:
|
|
|
|
print('Ups! Da wurde nicht 1 oder 2 gedrückt. Bitte nochmal versuchen.\n')
|
|
|
|
elif entry == 2:
|
|
|
|
print('Danke für\'s würfeln.\nBis Bald!')
|
|
|
|
exit()
|
2023-03-28 12:29:16 +02:00
|
|
|
elif entry > 1:
|
2023-03-28 18:59:38 +02:00
|
|
|
print('Ups! Da wurde nicht 1 oder 2 gedrückt. Bitte nochmal versuchen.\n')
|
2023-03-27 20:59:54 +02:00
|
|
|
except ValueError:
|
2023-03-28 18:59:38 +02:00
|
|
|
print('Ups! Da wurde nicht 1 oder 2 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
|
|
|
|