Manipulate lists with list comprehensions.
This commit is contained in:
父節點
65264ff543
當前提交
bfef8d1013
@ -294,6 +294,12 @@ can_ride_coaster = [height for height in heights if height > 161]
|
||||
print(can_ride_coaster)
|
||||
```
|
||||
|
||||
You can manipulate lists with list comprehensions as well:
|
||||
|
||||
```
|
||||
fahrenheit = [celsius * (9 / 5) + 32 for celsius in celsius]
|
||||
```
|
||||
|
||||
## Ranges
|
||||
|
||||
You can get a range of numbers using `range()`
|
||||
|
||||
載入中…
x
新增問題並參考
Block a user