DEV Community

SEAN
SEAN

Posted on

Day 5: Loops

Salutations!

Welcome to another day of exploration and my endeavours with the 30 days of code challenge, Day 5. Loops are the centre of todays attention.

Loops are a fundamental part of coding, which feature in almost all programming languages, so understanding them is paramount.

Python contains two different types of loops, the for loops and the while loop. For loops can iterate over a sequence of numbers using the range function. While loops repeat as long as a certain boolean condition is met.

Todays challenge involved using a loop to iterate over a variable 10 times and multiply it by the iteration number. i decided to do this in both styles of loop.

Here is my code for the for loop:
Alt Text
And here is the output:
Alt Text

Here is my code for the while loop:
Alt Text
and here is the output:
Alt Text

Top comments (0)