mirror of
https://github.com/Hizenberg469/Python-tutorial.git
synced 2026-04-19 23:12:24 +03:00
Error handling
This commit is contained in:
18
error-handling/error_handling.py
Normal file
18
error-handling/error_handling.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Error Handling
|
||||
|
||||
while True:
|
||||
try:
|
||||
age = int(input('what is your age? '))
|
||||
10/age
|
||||
except ValueError:
|
||||
print('please enter a number')
|
||||
continue
|
||||
except ZeroDivisionError:
|
||||
print('please enter age higher than 0')
|
||||
break
|
||||
else:
|
||||
print('thank you!')
|
||||
break
|
||||
finally:
|
||||
print('ok, I\' finally done')
|
||||
print('can you hear me?')
|
||||
Reference in New Issue
Block a user