parent
43f2e6223f
commit
db22bd3547
|
@ -46,6 +46,20 @@ for i in range(3, 12, 2):
|
|||
11
|
||||
```
|
||||
|
||||
#### Changes in Python 3
|
||||
In Python 3, by default the range function will not generate a list of integers when assigned to a variable. Instead, the user must manually convert it to a list.
|
||||
|
||||
#### Example usage in Python 3
|
||||
```py
|
||||
numbers = list(range(1, 10))
|
||||
print(numbers)
|
||||
```
|
||||
|
||||
#### Output
|
||||
```
|
||||
[1, 2, 3, 4, 5, 6, 7, 8, 9]
|
||||
```
|
||||
|
||||
## Input and Output types
|
||||
**Input** - All arguments to the range function must be integers (either built-in `int` or any object that implements the `__index__` special method).
|
||||
|
||||
|
|
Loading…
Reference in New Issue