Python 3: Try Except Else Finally - Learn about error handling in Python

Publicado em: 08 Maio 2022
no canal de: Cloud Security Training & Consulting
100
1

Python 3: Try Except Else Finally - Learn about error handling in Python

Try except
python cert - important concept
try:
number1 = int(input("Enter first number: "))
number2 = int(input("Enter second number: "))
division = number2 / number1
print(f'Result for division is {division}')

except ZeroDivisionError:
print("Cannot devide by zero!")
except:
print("Something went wrong")

else:
this block will only run when the try block is successful
print("Division was successful")

finally:
this block will always run
print("This code will always run")
print("Repeat with better values")


Nesta página do site você pode assistir ao vídeo on-line Python 3: Try Except Else Finally - Learn about error handling in Python duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Cloud Security Training & Consulting 08 Maio 2022, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 100 vezes e gostou 1 espectadores. Boa visualização!