Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
kurs_alx_pcz
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Patryk Czarnik
kurs_alx_pcz
Commits
77018acf
Commit
77018acf
authored
Nov 29, 2023
by
Patryk Czarnik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
teoria wyjątków - else
parent
3cc27b00
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletions
+5
-1
wyjatki5_finally.py
dzien5/wyjatki/wyjatki5_finally.py
+5
-1
No files found.
dzien5/wyjatki/wyjatki5_finally.py
View file @
77018acf
...
...
@@ -7,8 +7,11 @@ try:
print
(
'Wynik dzielenia:'
,
iloraz
)
except
ZeroDivisionError
as
e
:
print
(
f
'Dzielenie przez zero'
)
else
:
print
(
'else teraz się wykonuje'
)
# else wykonuje się po wykonaniu try, jeśli nie było żadnego wyjątku
finally
:
print
(
'
F
inally zawsze się wykona'
)
print
(
'
f
inally zawsze się wykona'
)
# finally wykona się w każdej sytuacji:
# 1) fragment programu w try bez błędów dojdzie do końca
# 2) nastąpi wyjątek obsłużony w except
...
...
@@ -16,3 +19,4 @@ finally:
# 4) gdy wyjdziemy w tego fragmentu kodu w inny sposób: return, break
print
(
'Koniec programu'
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment