list=[12,15,18,21,26] for i in list: if list % 5 == 0: print(list) break Traceback (most recent call last) <ipython-input-31-dbdee19fa7cd> in <module> 1 list=[12,15,18,21,26] 2 for i in list: ----> 3 if list % 5 == 0: 4 print(list) 5 break TypeError: unsupported operand type(s) for %: 'list' and 'int'
Use i % 5 instead of list % 5
i % 5
list % 5
list1 = [12,15,18,21,26] for i in list1: if i % 5 == 0: print(i) break
1.4m articles
1.4m replys
5 comments
57.0k users