- 10

list = [1, 2, 3, 4] if (list) % 2 == 0 print(list[ ])

23rd Oct 2016, 6:27 PM
pratibha limbole
pratibha limbole - avatar
10 Respostas
+ 8
list = [1, 2, 3, 4] if len(list) % 2 == 0: print(list[0])
2nd Jan 2017, 8:57 PM
Umesh Sevra
Umesh Sevra - avatar
+ 6
I was really stuck on that one, you need the lenght of the loop so use len and to print the first element just put the [0]. (y)
11th May 2017, 1:35 PM
Rihab Chakroun
Rihab Chakroun - avatar
+ 4
what is python
5th Jul 2019, 9:43 AM
michelle
michelle - avatar
+ 3
why should we take len function to get even numbers
9th Dec 2020, 1:59 PM
Manoj sai
0
list = [1, 2, 3] for var list: print( )
1st Jan 2020, 10:13 AM
Pradip Survase
Pradip Survase - avatar
0
list=[1,2,3,4] if len(list)%2==0: print(list[0])
23rd Mar 2020, 12:23 PM
vishven dhroov
0
It is a quiz question on the section control structure. The question was a bit tricky to understand. To get the number of elements in the list. we need to use len() function.
12th Dec 2020, 9:16 AM
Md Kamruzzaman
Md Kamruzzaman - avatar
0
i cant understand the print (list[0])
18th Nov 2021, 2:00 AM
Riz Ahmad
Riz Ahmad - avatar
- 1
list = [1, 2, 3] var list: print( )
1st Jan 2020, 10:10 AM
Pradip Survase
Pradip Survase - avatar
- 2
what is your question? not an expert in python but maybe you need a "for loop"?
5th Nov 2016, 9:00 PM
Birk
Birk - avatar