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
Andrew
intro
Commits
a62cd8f0
Commit
a62cd8f0
authored
May 07, 2017
by
Tancredi Orlando
Browse files
Various fixes.
parent
cfaceb39
Changes
1
Hide whitespace changes
Inline
Side-by-side
day_1.md
View file @
a62cd8f0
...
...
@@ -426,18 +426,53 @@ False
-
Non sono ordinati
-
Non contengono elementi duplicati
```
python
>>>
frutta
=
{
"mele"
,
"pere"
,
2
,
"zucchine"
,
"mele"
}
```
>>> frutta = {"mele", "pere", "zucchine", "mele"}
>>> frutta
{'mele', 2, 'arance', 'pere'}
```
-
Supportano le operazioni insiemistiche
-
---
```
python
Supportano le operazioni insiemistiche
```
>>> frutta = {"mele", "pere", "zucchine", "mele"}
>>> verdure = {"zucchine", "verze", "coste", "porri"}
>>> frutta.union(verdure)
{'porri', 'verze', 'pere', 'zucchine', 'coste', 'mele'}
>>> frutta.intersection(verdure)
{'zucchine'}
>>> frutta.difference(verdure)
{'pere', 'mele'}
>>> verdure.difference(frutta)
{'verze', 'coste', 'porri'}
```
----
La sintesi è anche espressività
```
>>> frutta = {"mele", "pere", "zucchine", "mele"}
>>> verdure = {"zucchine", "verze", "coste", "porri"}
>>> frutta | verdure
{'coste', 'verze', 'mele', 'pere', 'porri', 'zucchine'}
>>> frutta & verdure
{'zucchine'}
>>> frutta - verdure
{'mele', 'pere'}
>>> verdure - frutta
{'coste', 'verze', 'porri'}
```
----
...
...
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