Browse Source

Set, dict, random

pull/3/head
Jure Šorn 6 years ago
parent
commit
d1df107530
1 changed files with 9 additions and 0 deletions
  1. 9
      README.md

9
README.md

@ -36,6 +36,12 @@ Dictionary
<dict>.update(<dict>)
```
```python
>>> a = [(1, 4), (3, 50)]
>>> dict(a)
{1: 4, 3: 50}
```
```python
collections.defaultdict(<type>) # Creates a dictionary with default values.
dict(zip(keys, values)) # Initiates a dict from two lists.
@ -59,6 +65,8 @@ Set
<set>.union(<set>)
<set>.intersection(<set>)
<set>.difference(<set>)
<set>.issubset(<set>)
<set>..issuperset(<set>)
```
### Frozenset
@ -223,6 +231,7 @@ import random
random.random()
random.randint(from_inclusive, to_inclusive)
random.shuffle(<list>)
random.choice(<list>)
```
Infinity

Loading…
Cancel
Save