Loops · Python example
Print a ten-row multiplication table with a for loop and range().
A for loop is ideal when you know how many times to repeat an action. range(1, 11) produces the numbers 1 through 10.
number = 7
for multiplier in range(1, 11):
print(f"{number} x {multiplier} = {number * multiplier}")