+ 1

Help me please

Hello guys How create nested loop table , for each number from 1 toĀ num, the function should print out a list containing the first 10 multiples of theĀ number. for example input : 5 out: [1,2,3,4,5,6,7,8,9,10] [2,4,6,8,10,12,14,16,18,20] ... ... ... [5,10,15,20,25,30,35,40,45,50] for i in range (1, 11): for j in range (1, 11) if num % 10 == 0: lst.append(j*i) print(lst) My output [] , tell me please how is work ?

26th Feb 2021, 12:06 PM
Aid
Aid - avatar
5 Answers
+ 3
Aid you can just run a loop to multiply all the numbers in the list, then print the list, and set the list back to [1,2,3,4,5,6,7,8,9,10]! I made a code about this: https://code.sololearn.com/cDi6HIaF0Rac/?ref=app Hope it works! Happy programming :)
26th Feb 2021, 12:19 PM
TheCoder
+ 3
I am assuming num is 5 and so 5%10 always outputs 5 , therefore you get an empty list.
26th Feb 2021, 12:20 PM
Abhay
Abhay - avatar
+ 2
Abhay thanks 😊
26th Feb 2021, 12:27 PM
Aid
Aid - avatar
+ 1
Aid you're welcome! :) Also, it's not just me... Abhay also answered so thank him/her as well :)
26th Feb 2021, 12:25 PM
TheCoder
0
TheCoder thanks 😊
26th Feb 2021, 12:23 PM
Aid
Aid - avatar