Manipulate lists with list comprehensions.
This commit is contained in:
parent
65264ff543
commit
bfef8d1013
|
@ -294,6 +294,12 @@ can_ride_coaster = [height for height in heights if height > 161]
|
||||||
print(can_ride_coaster)
|
print(can_ride_coaster)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
You can manipulate lists with list comprehensions as well:
|
||||||
|
|
||||||
|
```
|
||||||
|
fahrenheit = [celsius * (9 / 5) + 32 for celsius in celsius]
|
||||||
|
```
|
||||||
|
|
||||||
## Ranges
|
## Ranges
|
||||||
|
|
||||||
You can get a range of numbers using `range()`
|
You can get a range of numbers using `range()`
|
||||||
|
|
Loading…
Reference in New Issue