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