# UPDATE ON WEEK 10 OF MY SOFTWARE ENGINEERING JOURNEY AT BLOCKFUSE LABS. This week there was no recap for last week we just move direct to what we suppose to do and we look at loops this week which gradually we getting to the hard part of basic python. We said loops are used to repeat a block of code multiple times. and in programming we have two types of loops that is the WHILE loop and FOR loop. the FOR loop repeat for a known number of times and WHILE loop repeat as long as the condition is true. Loops help in authomating repeatative task like printing, iterating through a list etc. lets take a look about FOR loop: ### HOW THE FOR LOOP WORKS: ```python #how the for loop works for i in range(9): print(i) #so this will print for 0 to 8 because by defualt range start from zero and don't include the last number. ``` The for loop is so easy and understandable but very useful. ### HOW THE WHILE LOOP WORKS: ```python count = 0 while count < 5: print(count) count += 1 ``` What is happening here is that we declere a variable call count and assign 0 as the value so using the while loop we are checking the condition if count is lessthan 5 and yes count is lessthan 5 so the codition is true so it will print the current count that is zero and under print we are incrimenting the count by 1 so now the current value of count is 1 and 1 is lessthan 5 so it will do same thing and ones count reach 4 it will stop looping cuz we are saying if it is lessthan 5 not equal 5. ### WHEN TO USE FOR LOOP: - when you know howmany thimes to loop - when you are looping through a sequence (like list, range or string) E.g ```python for i in range(9): # You want to loop 5 times ``` ### WHEN TO USE WHILE LOOP: - when you don't know how many times to loop. - when you want to loop until the codition changes. E.g ```python count = 0 while count < 5: # you want to keep looping as long as the the condition is true ``` This week we did't do much but understand well and this lead to and assignment which we were assign to build an airtime buy and borrow sistem i will drop the github repo link below you can check it out: https://github.com/DevSolex/Python-For-loops-Assignment ## CHECK IT OUT # NEVER SETTLE :100: