This content originally appeared on DEV Community and was authored by James Kabuga
What I learnt Today
1.Learnt while loops and how to impliment them.
On what I Learnt
While loops are a bit different from for loops as one has to create an initializer.
And in a while loop the condition at 1st has to be true so it can print a certain statement.
Also in a while loop it can be used when we don't know the number of times we want to iterate.
At the end we have to specify if we want to increment or decrement depending on what we want to achieve.
We apply incrementation or decrementation by reassigning the varible.
Syntax for a while-loop:
Count =0
while condition:
Do sth
Count += 1 or Count -= 1
Count =0 is the initalizer
Count +=1 is reassigning the variable.
I wrote a python script that prints even numbers between 1 and 20
Resources I used
A python refresher series by Bonaventure Ogeto
Github for documentating my learning journey in python.
What's Next
Tomorrow I'll learn how to impliment break and continue statements
This content originally appeared on DEV Community and was authored by James Kabuga
James Kabuga | Sciencx (2025-10-26T21:44:34+00:00) Day 16 of documentating my learning journey. Retrieved from https://www.scien.cx/2025/10/26/day-16-of-documentating-my-learning-journey/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.