(Parte1) try e except para tratar exceções

This commit is contained in:
Luiz Otávio
2022-11-04 11:22:22 -03:00
parent 031291cdac
commit db2d8aac0f

22
aula93.py Normal file
View File

@@ -0,0 +1,22 @@
# (Parte1) try e except para tratar exceções
# a = 18
# b = 0
# c = a / b
try:
a = 18
b = 0
# print(b[0])
print('Linha 1'[1000])
c = a / b
print('Linha 2')
except ZeroDivisionError:
print('Dividiu por zero.')
except NameError:
print('Nome b não está definido')
except (TypeError, IndexError):
print('TypeError + IndexError')
except Exception:
print('ERRO DESCONHECIDO.')
print('CONTINUAR')