0
How do you do this
okay so I did if [0,2,4,6,8,10] % 2==0: print("wow that's a surprise") what did I do wrong?
3 ответов
+ 3
You want to check a condition for all elements of the list, right? In that case, do this:
if all(i % 2 == 0 for i in [0,2,4,6,8,10]):
print("wow that's a surprise")
0
you cannot divide a list with integer.
if you want to divide the length of list with integer, use len() function.
if len([0,2,4,6,8,10]) ==0:
print("something")
0
ty zen and hammad