while True: print("Optionen: ") print("Gib 'adi' ein, wenn du Adieren willst.") print("Gib 'sub' ein, wenn du Subtrahieren willst.") print("Gib 'mul' ein, wenn du Multiplizieren willst.") print("Gib 'div' ein, wenn du Dividieren willst.") print("Gib 'end' ein, wenn du das Programm beenden willst.") user_input = input(": ") if user_input == "end": break print("Programm wurde beendet!") elif user_input == "adi": Adi_1 = float(input("Erste Adi Zahl: ")) Adi_2 = float(input("Zweite Adi Zahl: ")) result = str(Adi_1 + Adi_2) print("Das Ergebnis der Adition beträgt" + result) elif user_input == "sub": Sub_1 = float(input("Erste Sub Zahl: ")) Sub_2 = float(input("Zweite Sub Zahl: ")) result = str(Sub_1 - Sub_2) print("Das Ergebnis der Adition beträgt" + result) elif user_input == "nul": Mul_1 = float(input("Erste Mul Zahl: ")) Mul_2 = float(input("Zweite Mul Zahl: ")) result = str(Mul_1 * Mul_2) print("Das Ergebnis der Multiplikation beträgt" + result) elif user_input == "div": Div_1 = float(input("Erste Div Zahl: ")) Div_2 = float(input("Zweite Div Zahl: ")) result = str(Div_1 / Div_2) print("Das Ergebnis der Division beträgt" + result) else: print("Falsche Eingabe!")
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question