summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--loop.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/loop.py b/loop.py
new file mode 100644
index 0000000..d267af0
--- /dev/null
+++ b/loop.py
@@ -0,0 +1,8 @@
+i = 0;
+while i != 10:
+ print(i+1)
+ i = i + 1 # there's no increment in Python
+
+# for loop only works on collection, however you can use range() to implent numeric c-like loop
+for j in range(10):
+ print(j+1) \ No newline at end of file