In programming, loops are used to execute a block of code repeatedly. Python supports two main types of loops: for
loops and while
loops.
for
loop in Python is used to iterate over a sequence (such as a list, tuple, string, or range).while
loop in Python is used to execute a block of code as long as a condition is true.