From 9f5cedcc4fd0cf4fb27de0623b9235216487e5dc Mon Sep 17 00:00:00 2001 From: kjg Date: Fri, 29 May 2020 21:54:51 +0900 Subject: [PATCH] [Python #6] create e33.py --- kjg/python-the-hard-way/e33.py | 19 +++++++++++++++++++ kjg/python.org | 2 ++ 2 files changed, 21 insertions(+) create mode 100644 kjg/python-the-hard-way/e33.py diff --git a/kjg/python-the-hard-way/e33.py b/kjg/python-the-hard-way/e33.py new file mode 100644 index 0000000..99eb8be --- /dev/null +++ b/kjg/python-the-hard-way/e33.py @@ -0,0 +1,19 @@ +i = 0 +numbers = [] + +test = 7 + +#while i < test: +for i in range(0, test): + print(f"At the top i is {i}") + numbers.append(i) + + i = i + 2 + print("Numbers now: ", numbers) + print(f"At the bottom i is {i}") + + +print("The numbers: ") + +for num in numbers: + print(num) diff --git a/kjg/python.org b/kjg/python.org index 35bfee4..61efb6a 100644 --- a/kjg/python.org +++ b/kjg/python.org @@ -124,3 +124,5 @@ How to use if, elif *** Python #6 **** ex32 How to use for-loop +**** ex33 +How to use while-loop