From 0fb4b805df07d006b1bb01c7e71cc225010178f6 Mon Sep 17 00:00:00 2001 From: Kyle K Date: Mon, 18 Dec 2023 21:31:27 -0600 Subject: add loop file --- loop.py | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 loop.py (limited to 'loop.py') 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 -- cgit v1.2.3