mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-24 15:51:41 +03:00
Merge pull request #1343 from VeerpalB/VeerpalB-patch-1
[python3/en]Add step parameter to range function
This commit is contained in:
commit
4c7c47cb8f
@ -352,6 +352,18 @@ for i in range(4, 8):
|
|||||||
print(i)
|
print(i)
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
"range(lower, upper, step)" returns an iterable of numbers
|
||||||
|
from the lower number to the upper number, while incrementing
|
||||||
|
by step. If step is not indicated, the default value is 1.
|
||||||
|
prints:
|
||||||
|
4
|
||||||
|
6
|
||||||
|
8
|
||||||
|
"""
|
||||||
|
for i in range(4, 8, 2):
|
||||||
|
print(i)
|
||||||
|
"""
|
||||||
|
|
||||||
While loops go until a condition is no longer met.
|
While loops go until a condition is no longer met.
|
||||||
prints:
|
prints:
|
||||||
0
|
0
|
||||||
|
Loading…
Reference in New Issue
Block a user