This commit is contained in:
alstergym
2026-09-18 09:14:16 +02:00
parent ce085e53eb
commit f98f2fa7ec
14 changed files with 199 additions and 16 deletions
+27
View File
@@ -0,0 +1,27 @@
import random
def auswertung():
while True:
try:
zahl = int(input("Dein Tipp: "))
return zahl
except ValueError:
print("Gib eine ganze Zahl ein")
geheimzahl = random.randint(1, 100)
versuche = 0
print("Errate eine Zahl")
while True:
tipp = auswertung()
versuche += 1
if tipp < geheimzahl:
print("Zu klein!")
elif tipp > geheimzahl:
print("Zu groß")
else:
print("Richtig!")
print("Du hast" , versuche , "Versuche gebraucht.")
break