0

##python### list=[1,2,3,4] if (list)%2==0: # after 'if' ther is something to add that is where i am stick print(list(0))

Print the first element of the list, if it contains even number element.

30th Apr 2020, 8:28 AM
Sebastian
4 Respuestas
+ 5
lst = [1,2,3,4] new_lst =[] for i in lst: if i%2==0: new_lst.append(i) print(new_lst[0])
30th Apr 2020, 8:44 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 4
What are you trying to achieve please make it more clear? I think you are trying to separate odd and even numbers from the list. but check this out https://code.sololearn.com/cXenkOF79ZLb/?ref=app
30th Apr 2020, 8:29 AM
minirkk
minirkk - avatar
+ 3
"To print the first element of the list, if it contains even number of elements." if len(list) % 2 == 0: print(list[0]) P.S. Please consider revising the chapter, in case this was taken from a lesson. All lesson quiz answer are there in the lesson, just a swipe away : )
30th Apr 2020, 8:59 AM
Ipang
+ 1
How to make quiz?
30th Apr 2020, 9:07 AM
Rahym Basimow
Rahym Basimow - avatar