fill the blank | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 3

fill the blank

What should I put in the blank for print first item of list if one element of list is even !? list = [1,2,3,4] if ___ (list) % 2 == 0 : print (list[0])

16th Jul 2018, 5:58 PM
metaamiri
metaamiri - avatar
3 ответов
+ 6
meta to add on to what Lachlan said I have this code https://code.sololearn.com/cSNYMigx1d0v/?ref=app
16th Jul 2018, 9:36 PM
LONGTIE👔
LONGTIE👔 - avatar
+ 5
You could do a "for" loop to iterate over every item in the list and check if it is even for every item like this: list = [1,2,3,4] for item in list: if item % 2 == 0: print(list[0]) Check out the tutorial for "for" loops in the python tutorial on Sololearn.
16th Jul 2018, 9:14 PM
Lachlan
+ 3
tnx a lot
17th Jul 2018, 1:03 AM
metaamiri
metaamiri - avatar