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š
prm1
Commits
a71d9073
Commit
a71d9073
authored
Nov 19, 2019
by
Martin Mareš
Browse files
Slovníky: Příklady
parent
68ad052a
Changes
2
Hide whitespace changes
Inline
Side-by-side
08-slovniky/kontakty.py
0 → 100644
View file @
a71d9073
# Seznam kontaktů
kontakty
=
[
{
"jmeno"
:
"Pokusný"
,
"prijmeni"
:
"Králík"
,
"telefony"
:
[
"123456789"
,
"+420999888777"
],
"adresa"
:
{
"ulice"
:
"Norní"
,
"dum"
:
"42/1b"
,
"mesto"
:
"Králíky"
,
"psc"
:
"987 65"
,
},
},
{
"jmeno"
:
"Kocour"
,
"prijmeni"
:
"Mikeš"
,
"telefony"
:
[],
"adresa"
:
{
"ulice"
:
"Josefa Lady"
,
"dum"
:
"1"
,
"mesto"
:
"Hrusice"
,
"psc"
:
"251 66"
,
}
},
]
08-slovniky/robutek.py
0 → 100755
View file @
a71d9073
#!/usr/bin/env python3
x
,
y
=
0
,
0
dx
,
dy
=
1
,
0
def
prikaz_krok
():
global
x
,
y
,
dx
,
dy
x
+=
dx
y
+=
dy
def
prikaz_vlevo
():
global
dx
,
dy
dx
,
dy
=
-
dy
,
dx
def
prikaz_vpravo
():
global
dx
,
dy
dx
,
dy
=
dy
,
-
dx
prikazy
=
{
"krok"
:
prikaz_krok
,
"vlevo"
:
prikaz_vlevo
,
"vpravo"
:
prikaz_vpravo
,
}
def
proved
(
prikaz
):
if
prikaz
in
prikazy
:
prikazy
[
prikaz
]()
else
:
print
(
"Neznámý příkaz!"
)
while
True
:
print
(
f
"Pozice: (
{
x
}
,
{
y
}
), směr: (
{
dx
}
,
{
dy
}
)"
)
prikaz
=
input
(
"Příkaz: "
)
proved
(
prikaz
)
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