+ 1
Why variable / 2 is not printing?
try: variable = 10 print(variable + "hello") print(variable / 2) except ZeroDivisionError: print("Divided by zero") except (ValueError, TypeError): print("Error occurred")
3 odpowiedzi
+ 5
It's not printing because you forgot to remove or correct the line above it that's causing the error. ;)
CHANGE TO:
variable = 10
print(str(variable) + "hello")
print(variable / 2)
OUTPUT:
10hello
5.0
0
Variable + hello is a type error, its ok, but variable / 2 == 5 right??
0
Ok i get it, because code is stoping on variable + hello line