Python 3 Change (#28596)

Included difference in python 3 vs python 2
pull/31013/head
Nayan Chawla 2019-05-12 16:33:15 -05:00 committed by Randell Dawson
parent 43f2e6223f
commit db22bd3547
1 changed files with 14 additions and 0 deletions

View File

@ -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).