python-CSD-kursu/python-temel/exception.example.13.py
2023-08-22 12:56:59 +03:00

27 lines
493 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('Sayı istenildiği gibi değil')
finally:
print('İç try bloğunun finally bölümü')
print('bar ends...')
def foo(a):
print('foo begins...')
bar(a)
print('foo ends...')
try:
foo(10.5)
except TypeError:
print('Sayı int türden değil!')
print('ends..')