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
553258aa
Commit
553258aa
authored
Nov 29, 2023
by
Patryk Czarnik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
powtorz_napis - wartość domyślna
parent
57cd022a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletions
+7
-1
powtorz_napis.py
dzien5/przyklady_funkcji/powtorz_napis.py
+7
-1
No files found.
dzien5/przyklady_funkcji/powtorz_napis.py
View file @
553258aa
...
@@ -2,10 +2,16 @@
...
@@ -2,10 +2,16 @@
# i podany napis wypisuje na ekran tyle razy, ile wynosi drugi parametr
# i podany napis wypisuje na ekran tyle razy, ile wynosi drugi parametr
# W programie testowo wywołać tę funkcję z różnymi argumentami.
# W programie testowo wywołać tę funkcję z różnymi argumentami.
def
powtorz_napis
(
napis
,
ile_razy
):
def
powtorz_napis
(
napis
,
ile_razy
=
1
):
for
i
in
range
(
ile_razy
):
for
i
in
range
(
ile_razy
):
print
(
napis
)
print
(
napis
)
powtorz_napis
(
'Ala ma kota'
,
5
)
powtorz_napis
(
'Ala ma kota'
,
5
)
powtorz_napis
(
'Ola ma psa'
,
3
)
powtorz_napis
(
'Ola ma psa'
,
3
)
# Korzystamy z domyślnej wartości ile_razy=1
powtorz_napis
(
'Jedna linia'
)
# Podczas wywołania podajemy nazwy parametrów - można wtedy wpisać je w innej kolejności
powtorz_napis
(
ile_razy
=
2
,
napis
=
'Dwa razy dwa'
)
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