summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAdam Bard <github@adambard.com>2015-10-05 22:53:41 +0800
committerAdam Bard <github@adambard.com>2015-10-05 22:53:41 +0800
commit4c7c47cb8fa35fd7cab3ae2fc72fcfc3fe92387f (patch)
treeb81e8da11efe3b87e68aa8703127e01d08f1d5e4
parent3f03b9e528b18e6540969caef2f8302a1436dd8a (diff)
parent82bdd1b1c8c5eaa49289d9a683bf87ed85b99be9 (diff)
Merge pull request #1343 from VeerpalB/VeerpalB-patch-1
[python3/en]Add step parameter to range function
-rw-r--r--python3.html.markdown12
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