There are two types of common loops in Python
"While Loops" and "For Loops"
If you wish to repeat a process until a certain requirement is met then it is best to use a "While Loop"
Consider we wish to sum up the values 1-5:
x = 0
sum_total = 0
while x <=5:
sum_total = sum_total + x
x = x+1
This Code will repeat WHILE x<=5x<=5x<=5
15 is correctly produced by this code
What about using a FOR loop?
A "For Loop" is best when you know the number of iterations you want your code to run
for n in range (1,6):
sum_tot= sum_tot +n