27 lines
484 B
Python
27 lines
484 B
Python
# Deklaration von 2 Variablen
|
|
int_zahl1 = 5
|
|
int_zahl2 = 3
|
|
|
|
# If/Elif/Else
|
|
if int_zahl1 < int_zahl2:
|
|
print("Zahl 2 größer als Zahl 1")
|
|
|
|
elif int_zahl1 > int_zahl2:
|
|
print("Zahl 1 größer als Zahl 2")
|
|
|
|
else:
|
|
print("Error")
|
|
|
|
# Error handling
|
|
try:
|
|
if int_zahl1 < int_zahl2:
|
|
print("Zahl 2 größer als Zahl 1")
|
|
|
|
elif int_zahl1 > int_zahl2:
|
|
print("Zahl 1 größer als Zahl 2")
|
|
|
|
else:
|
|
print("Error")
|
|
|
|
except:
|
|
print("Programm hat fehler") |