From 2891e04afd9feaccbe14efcc11f52fbc0719c493 Mon Sep 17 00:00:00 2001 From: msnau <79276215+msnau@users.noreply.github.com> Date: Thu, 27 Aug 2026 20:13:25 +0200 Subject: [PATCH] =?UTF-8?q?Dateiendung=20ge=C3=A4ndert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Chatbot => Chatbot.py | 0 Zahlenspiel.py | 28 ++++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) rename Chatbot => Chatbot.py (100%) create mode 100644 Zahlenspiel.py diff --git a/Chatbot b/Chatbot.py similarity index 100% rename from Chatbot rename to Chatbot.py diff --git a/Zahlenspiel.py b/Zahlenspiel.py new file mode 100644 index 0000000..50b75a5 --- /dev/null +++ b/Zahlenspiel.py @@ -0,0 +1,28 @@ +import random + +rzahl = (random.randint(1,100)) + +Versuch = 1 +while Versuch < 8: + print("Willkommen im Spiel, welche Zahl rätst du?") + gzahl = input("Bitte Zahl eingeben: ") + try: + gzahl = int(gzahl) + if gzahl < 1 or gzahl > 100: + print("Die Zahl ist um"), print(gzahl-100), print("zu groß") + continue + except ValueError: + print("Bruder... das ist keine erlaubte Zahl") + continue + + + Versuch = Versuch + 1 + if gzahl > rzahl: + print("zu groß") + if gzahl < rzahl: + print("zu klein") + if gzahl == rzahl: + print ("Gewonnen!") + break + +print("Es war", rzahl)