#! /usr/bin/env python3 import random, operator class my_rechner: def __init__(self): self.zahl1 = random.randint(1, 1000) self.zahl2 = random.randint(1, 1000) self.operators = [('+', operator.add), ('-', operator.sub), ('*', operator.mul), ('/', operator.truediv) ] self.op, self.fn = random.choice(self.operators) def check_input(self): pass def rechnen(self): pass def check_rechnen(self): self.zahl1 = random.randint(1, 1000) self.zahl2 = random.randint(1, 1000) self.op, self.fn = random.choice(self.operators) def main_run(self): 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 :") self.check_rechnen() print("Deine Input", my_ergebnis) print("Ergebniss", summe) 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) rechnen_now = my_rechner() rechnen_now.main_run()