Manipulated numbers.

This commit is contained in:
Josh Mudge 2019-01-30 21:12:24 -07:00
parent bfef8d1013
commit 78520801ea
1 changed files with 14 additions and 0 deletions

View File

@ -300,6 +300,20 @@ You can manipulate lists with list comprehensions as well:
fahrenheit = [celsius * (9 / 5) + 32 for celsius in celsius]
```
### Print manipulated numbers in for loop
```
single_digits = range(10)
squares = []
cubes = [(num ** 3) for num in single_digits]
for single_digits in single_digits:
print(single_digits)
squares.append(single_digits ** 2)
print(squares)
print(cubes)
```
## Ranges
You can get a range of numbers using `range()`