FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
programmingWithPythonCode/questions/function_01.py at main · thomasWeise/programmingWithPythonCode · GitHub
thomasWeise
programmingWithPythonCode
Repository navigation
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
programmingWithPythonCode
/
questions
/
function_01.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
22 lines (16 loc) · 518 Bytes
Breadcrumbs
programmingWithPythonCode
/
questions
/
function_01.py
Copy path
File metadata and controls
22 lines (16 loc) · 518 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
""" An example of a function. """
def
compute
(
lst
:
list
[
int
])
->
list
[
int
]:
"""
Perform a computation with the list `lst`.
:param lst: the input list
:return: the output list
"""
result
:
list
[
int
]
=
[]
copy
:
list
[
int
]
=
list
(
lst
)
while
len
(
copy
)
>
0
:
x
:
int
=
min
(
copy
)
result
.
append
(
x
)
copy
.
remove
(
x
)
return
result
print
(
compute
([
5
,
4
,
1
,
3
,
2
]))
# Line 21: What does it print?
print
(
compute
([
25
,
-
34
,
6
,
-
5
,
9
]))
# Line 22: What does it print?
Back
|
FazBrowse Home
|
New Git URL