Skip to content

Commit 2c1753b

Browse files
Update range.md with Examples
I gave more examples for the range built-in function. I do not think that this is complete and will add more when I can but I wanted to add at least a few more examples to allow developers to see it in use.
1 parent 9044f1d commit 2c1753b

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

docs/builtin/range.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,72 @@ Python range() built-in function
2828
# 4
2929
```
3030

31+
```python
32+
>>> for i in range(1,8):
33+
... print(i)
34+
# 1
35+
# 2
36+
# 3
37+
# 4
38+
# 5
39+
# 6
40+
# 7
41+
```
42+
43+
```python
44+
>>> for i in range(0,30,5):
45+
... print(i)
46+
# 0
47+
# 5
48+
# 10
49+
# 15
50+
# 20
51+
# 25
52+
```
53+
54+
```python
55+
>>> for i in range(0,10,3):
56+
... print(i)
57+
# 0
58+
# 3
59+
# 6
60+
# 9
61+
```
62+
63+
```python
64+
>>> for i in range(0,-6,-1):
65+
... print(i)
66+
# 0
67+
# -1
68+
# -2
69+
# -3
70+
# -4
71+
# -5
72+
```
73+
74+
```python
75+
>>> for i in range(0,-6,-1):
76+
... print(i)
77+
# 0
78+
# -1
79+
# -2
80+
# -3
81+
# -4
82+
# -5
83+
```
84+
85+
```python
86+
>>> for i in range(0):
87+
... print(i)
88+
#
89+
```
90+
91+
```python
92+
>>> for i in range(1,0):
93+
... print(i)
94+
#
95+
```
96+
3197
<!-- remove this tag to start editing this page -->
3298
<empty-section />
3399
<!-- remove this tag to start editing this page -->

0 commit comments

Comments
 (0)