Manipulate lists with list comprehensions.

This commit is contained in:
Josh Mudge 2019-01-29 18:23:28 -07:00
parent 65264ff543
commit bfef8d1013
1 changed files with 6 additions and 0 deletions

View File

@ -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()`