diff options
author | VeerpalB <VeerpalB@users.noreply.github.com> | 2015-10-04 19:41:13 -0400 |
---|---|---|
committer | VeerpalB <VeerpalB@users.noreply.github.com> | 2015-10-04 19:41:13 -0400 |
commit | 82bdd1b1c8c5eaa49289d9a683bf87ed85b99be9 (patch) | |
tree | cf5a22ae41796c94b3a24fb6bfa804477b846bcc /python3.html.markdown | |
parent | 9b46fe7e57bcf63785b67cdaffc49ff0d47d7476 (diff) |
Add step parameter to range function
A description of the step parameter of the range function is added. An example of its use in a for loop is also given.
Diffstat (limited to 'python3.html.markdown')
-rw-r--r-- | python3.html.markdown | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/python3.html.markdown b/python3.html.markdown index b3acb122..4696ae1c 100644 --- a/python3.html.markdown +++ b/python3.html.markdown @@ -352,6 +352,18 @@ for i in range(4, 8): 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. prints: 0 |