Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
python-uga
py-training-2017
Commits
61b8b54c
Commit
61b8b54c
authored
Dec 04, 2019
by
Loic Huder
Browse files
Changed example of dict comprehension
parent
3f7d1271
Pipeline
#32973
passed with stage
in 57 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
ipynb/pres07_data_struct.ipynb
View file @
61b8b54c
...
...
@@ -310,11 +310,11 @@
ns
.
pop
()
```
%%%% Output: execute_result
3
12
%% Cell type:markdown id: tags:
## Complity :
...
...
@@ -452,13 +452,14 @@
```
%% Cell type:code id: tags:
```
python
# dict comprehension (here
for the "inversion" of the dictionary
)
# dict comprehension (here
to change the case of values
)
print
(
d
)
d1
=
{
v
:
k
for
k
,
v
in
d
.
items
()}
d1
=
{
k
:
v
.
upper
()
for
k
,
v
in
d
.
items
()}
print
(
d1
)
```
%% Cell type:markdown id: tags:
## Do it yourself:
...
...
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