Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Martin Mareš
prm2
Commits
01945cfe
Commit
01945cfe
authored
Apr 19, 2021
by
Martin Mareš
Browse files
Seznamy: Drobnosti v šabloně úkolu
parent
64f1e21f
Changes
2
Hide whitespace changes
Inline
Side-by-side
05-seznamy/sorted_list.py
View file @
01945cfe
...
...
@@ -38,8 +38,9 @@ class SortedList:
def
pred
(
self
,
x
):
"""Vrátí předchůdce čísla x, tedy největší prvek seznamu,
který je ostře menší než x. Není-li takový, vrátí None.
"""Vrátí předchůdce čísla x, tedy největší hodnotu v seznamu,
která je ostře menší než x. Není-li taková, vrátí None.
Číslo x může, ale nemusí být prvkem seznamu.
"""
# TODO
...
...
@@ -47,8 +48,9 @@ class SortedList:
def
succ
(
self
,
x
):
"""Vrátí následníka čísla x, tedy nejmenší prvek seznamu,
který je ostře větší než x. Není-li takový, vrátí None.
"""Vrátí následníka čísla x, tedy nejmenší hodnotu v seznamu,
která je ostře větší než x. Není-li taková, vrátí None.
Číslo x může, ale nemusí být prvkem seznamu.
"""
# TODO
...
...
05-seznamy/sorted_list_test.py
View file @
01945cfe
...
...
@@ -13,7 +13,7 @@ def expect_items(sorted_list, elements):
this
=
sorted_list
.
first
for
x
in
elements
:
assert
this
,
"Nalezen konec seznamu místo prvku {}"
.
format
(
x
)
assert
this
.
value
==
x
,
"Nalezen prv
k
e {} místo {}"
.
format
(
this
.
value
,
x
)
assert
this
.
value
==
x
,
"Nalezen prve
k
{} místo {}"
.
format
(
this
.
value
,
x
)
this
=
this
.
next
assert
not
this
,
"Nalezen nadbytečný prvek {} na konci seznamu"
.
format
(
this
.
value
)
...
...
Write
Preview
Supports
Markdown
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