If condition | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

If condition

List=[1,2,3,4] For ... (list)= 2 : Print ... What do I need to put in the blanks

27th Jul 2019, 1:33 PM
Abdullah Alotaibi
6 Answers
27th Jul 2019, 1:38 PM
David Ashton
David Ashton - avatar
+ 3
Learn
27th Jul 2019, 3:15 PM
Isaac Jordan
Isaac Jordan - avatar
+ 1
Fill in the blanks to print the first element of the list, if it contains even number of elements list [1, 2, 3, 4] if ...... (list) % 2 == 0: print(list[....])
27th Jul 2019, 1:43 PM
Abdullah Alotaibi
+ 1
Abdullah Welcome to SoloLearn! You've finished one third of the Python course in 2 days. In my experience, that's too fast for the information to sink in. I would suggest starting over and practicing everything in the Code Playground as you go along (then you would probably know the answers yourself). James gave you the answers. To show that you understand the concepts of len(), x % 2 == 0, and index positions, I would invite you to explain why James's answers are correct! 😉
28th Jul 2019, 3:53 AM
David Ashton
David Ashton - avatar
0
if not for sorry
27th Jul 2019, 1:44 PM
Abdullah Alotaibi
0
len 0
27th Jul 2019, 1:45 PM
James
James - avatar