commit message from python script

This commit is contained in:
2024-05-02 10:36:56 +02:00
parent c13740a203
commit 5ba107cf28

View File

@@ -9,6 +9,8 @@ class my_rechner:
self.zahl2 = random.randint(1, 1000)
self.operators = [('+', operator.add), ('-', operator.sub), ('*', operator.mul), ('/', operator.truediv) ]
self.op, self.fn = random.choice(self.operators)
self.count_true = 0
self.count_false = 0
def check_input(self):
@@ -26,20 +28,23 @@ class my_rechner:
while True:
print("Rechne {zahl1} {op} {zahl2} ".format(zahl1=self.zahl1, op=self.op, zahl2=self.zahl2))
summe = self.fn(self.zahl1, self.zahl2)
my_ergebnis = input("Was ist dein Ergebnis :")
summe = round(float(self.fn(self.zahl1, self.zahl2)),2)
my_ergebnis = float(input("Was ist dein Ergebnis :"))
self.check_rechnen()
print("Deine Input", my_ergebnis)
if my_ergebnis == summe:
self.count_true = self.count_true + 1
print("richtig !!!")
print("Ergebniss", summe)
print("Du hast insgesamt", self.count_true, "richtig")
check_input = input("Willst du aufhöhren ? (j) :")
if len(check_input) == 1 and check_input == "j":
break
else:
print("false")
if __name__ == "__main__":
print("Running Main", "." *3)
print("Running Main", "." * 3)
rechnen_now = my_rechner()
rechnen_now.main_run()