What should I fill in the blank spaces to print the first element of the list? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What should I fill in the blank spaces to print the first element of the list?

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

7th Sep 2016, 11:43 AM
Shankar Balasubramaniam
Shankar Balasubramaniam - avatar
2 Answers
+ 3
Only if it contains an even number of elements, right? list=[1,2,3,4] if len(list)%2==0: print(list[0])
7th Sep 2016, 12:15 PM
Zen
Zen - avatar
+ 1
list=[1,2,3,4] if len(list)%2==0: print(list[0])
4th May 2018, 10:45 AM
Mahnoor Shahzad
Mahnoor Shahzad - avatar