27 lines
807 B
Python
Executable File
27 lines
807 B
Python
Executable File
#!/usr/bin/python3
|
|
import random
|
|
import os
|
|
|
|
cube = 'Würfel-Generator\n'
|
|
print(cube.center(54))
|
|
def cube():
|
|
while True:
|
|
try:
|
|
entry = int(input('1 drücken zum Würfeln.\n2 drücken zum beenden.\n'))
|
|
|
|
if entry == 1:
|
|
os.system("clear")
|
|
print(random.randint(1, 6))
|
|
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()
|
|
elif entry > 1:
|
|
print('Ups! Da wurde nicht 1 oder 2 gedrückt. Bitte nochmal versuchen.\n')
|
|
except ValueError:
|
|
print('Ups! Da wurde nicht 1 oder 2 gedrückt. Bitte nochmal versuchen.\n')
|
|
|
|
cube()
|
|
|