Code: Alles auswählen
print("Hello World")
Habt ihr verbesserungsvorschläge?
Code: Alles auswählen
print("Operation:")
print("1:Addition")
print("2:Subtraktion")
print("3:Multiplikation")
print("4:Division")
print("5:Integer Division")
print("6:Modulo")
print("7:Potenzieren")
nochmal="ja"
while nochmal=="ja":
operation=int(input("Waehlen sie die entsprechende Nummer von 1-7:"))
ersteZahl=int(input("Geben sie die erste Zahl ein:"))
zweiteZahl=int(input("Geben sie die zweite Zahl ein:"))
if operation==1:
Ergebnis=ersteZahl+zweiteZahl
elif operation==2:
Ergebnis=ersteZahl-zweiteZahl
elif operation==3:
Ergebnis=ersteZahl*zweiteZahl
elif operation==4:
Ergebnis=ersteZahl/zweiteZahl
elif operation==5:
Ergebnis=ersteZahl//zweiteZahl
elif operation==6:
Ergebnis=ersteZahl%zweiteZahl
else:
Ergebnis=ersteZahl**zweiteZahl
print("Das Ergebnis ist",Ergebnis)
nochmal=input("Wollen sie noch eine Rechnung durchfuehren? 'ja' oder 'nein'")