0
Range(20) starts from 0 or 1?
5 Réponses
+ 7
Just adding to the answer, there's a complete documentation of range here.
https://docs.python.org/3/library/stdtypes.html#typesseq-range
'... If the start argument is omitted, it defaults to 0. '
+ 3
Thank you [BusyTheseDays] Hatsy Rei
+ 1
range(start, stop, step)
range(20) means = range(0, 20, 1)
It start from 0 and ends at 19.
You can run this code↓
for i in range(20):
print(i)
Output:
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
+ 1
Starts from 0 and it will print up to 19
0 to 19 means 20 numbers are printing in a given range
- 1
Why don't you check it by yourself ??