python-CSD-kursu/python-temel/exception.example.8.py
2023-08-22 07:41:43 +03:00

28 lines
549 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

def bar(a):
print('bar begins...')
try:
if not isinstance(a, int):
raise TypeError
if a < 0:
raise ValueError
except ValueError:
print('İç try deyiminin ValueError except bloğu')
print('bar ends...')
def foo(a):
print('foo begins...')
bar(a)
print('foo ends...')
try:
foo(-1)
except TypeError:
print('Dış try deyiminin TypeError except bloğu')
except ValueError:
print('Dış try deyiminin ValueError except bloğu')
print('program sonlanıyor...')