Programmin-in-Python

Printing the qty of divisible numbers and the numbers itself within a list

May 4th, 2021
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.37 KB | None | 0 0
  1. L1 = ['12', 41, '-41', 190, '115', 96,
  2.     24, 21, 41, 72, 11, 19, 20, 29, 77,
  3.     56, 60, 64, 12, 50, 10, 110, 224,
  4.     1200, '-70', 650, 7, 72, 52, 35, 5, 90]
  5.  
  6. for i in L1:
  7.     res = []
  8.     divr = int(i)
  9.  
  10.     for j in L1:
  11.         if int(j)%divr == 0:
  12.             res += [j]
  13.  
  14.     print(f"The No of Numbers that are divisible by {i} : {len(res)}")
  15.     print(f"The Numbers divisible by {i} are {res}\n\n\n")
Advertisement
Add Comment
Please, Sign In to add comment