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.
4 Antworten
+ 5
lst = [1,2,3,4]
new_lst =[]
for i in lst:
if i%2==0:
new_lst.append(i)
print(new_lst[0])
+ 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
+ 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 : )
+ 1
How to make quiz?