num = 12 # use for loop to iterate 10 times for i in range(1, 11): print(num,'x',i,'=',num*i)
10 x 1 = 10 10 x 2 = 20 10 x 3 = 30 10 x 4 = 40 10 x 5 = 50 10 x 6 = 60 10 x 7 = 70 10 x 8 = 80 10 x 9 = 90 10 x 10 = 100
To iterate 10 times,for
loop along with therange()
function is used. The arguments inside range function is (1, 11) meaning, greater than or equal to 1 and less than 11 (meaning 10).