mirror of
https://github.com/apachecn/ailearning.git
synced 2026-05-04 01:41:29 +08:00
2020-10-19 21:08:55
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
|
||||
In [1]:
|
||||
|
||||
```
|
||||
```py
|
||||
s = frozenset([1, 2, 3, 'a', 1])
|
||||
s
|
||||
|
||||
@@ -14,7 +14,7 @@ s
|
||||
|
||||
Out[1]:
|
||||
|
||||
```
|
||||
```py
|
||||
frozenset({1, 2, 3, 'a'})
|
||||
```
|
||||
|
||||
@@ -24,7 +24,7 @@ frozenset({1, 2, 3, 'a'})
|
||||
|
||||
In [2]:
|
||||
|
||||
```
|
||||
```py
|
||||
flight_distance = {}
|
||||
city_pair = frozenset(['Los Angeles', 'New York'])
|
||||
flight_distance[city_pair] = 2498
|
||||
@@ -36,7 +36,7 @@ flight_distance
|
||||
|
||||
Out[2]:
|
||||
|
||||
```
|
||||
```py
|
||||
{frozenset({'Austin', 'New York'}): 1515,
|
||||
frozenset({'Austin', 'Los Angeles'}): 1233,
|
||||
frozenset({'Los Angeles', 'New York'}): 2498}
|
||||
@@ -46,26 +46,26 @@ Out[2]:
|
||||
|
||||
In [3]:
|
||||
|
||||
```
|
||||
```py
|
||||
flight_distance[frozenset(['New York','Austin'])]
|
||||
|
||||
```
|
||||
|
||||
Out[3]:
|
||||
|
||||
```
|
||||
```py
|
||||
1515
|
||||
```
|
||||
|
||||
In [4]:
|
||||
|
||||
```
|
||||
```py
|
||||
flight_distance[frozenset(['Austin','New York'])]
|
||||
|
||||
```
|
||||
|
||||
Out[4]:
|
||||
|
||||
```
|
||||
```py
|
||||
1515
|
||||
```
|
||||
Reference in New Issue
Block a user