+ 1

Python challenge

Hi there. I was recently participating in Sololearn Python Challenge game and faced a strange question: Made a screenshot of it. It seems erroneous. Showed to my experienced colleague and he says the same. Could you suggest, what you think it is? ”Fill in the blanks (marked them as ...) to print all even numbers in the list.” Lst= [] For i in range(12): If i[b] ... ... [/b]2 == 0: Lst.append(...) continue print (Lst)

12th Apr 2019, 5:45 AM
viktoras ciumanovas
viktoras ciumanovas - avatar
9 Antworten
+ 7
if i%2 == 0: lst.append(i)
12th Apr 2019, 5:51 AM
Gordon
Gordon - avatar
+ 5
I think I know what is happening. The [b] ... [/b] is like an opening and closing tag like in html and are supposed to be invissible. Gordons solution is 100% correct. The problem with it being visible is it looks like a list being adressed.i[b] And i is an integer, not a list And b is not defined
12th Apr 2019, 7:35 AM
Louis
Louis - avatar
+ 3
viktoras ciumanovas do you have an apple?
12th Apr 2019, 6:45 AM
Louis
Louis - avatar
+ 3
viktoras ciumanovas Sorry, feed post is not yet available on IOS.
12th Apr 2019, 6:52 AM
Louis
Louis - avatar
+ 1
Hi Louis, yes I have screenshot, just not sure how to post it in the feed (was not allowed to paste screenshot as part of the question either). Would you mind giving me a hint how to add screenshot to the feed?
12th Apr 2019, 6:39 AM
viktoras ciumanovas
viktoras ciumanovas - avatar
+ 1
yes
12th Apr 2019, 6:47 AM
viktoras ciumanovas
viktoras ciumanovas - avatar
+ 1
Ok, no issue. I can send it via e-mail or add it somewhere (i.e., cloud) - still think it would be good to address
12th Apr 2019, 6:55 AM
viktoras ciumanovas
viktoras ciumanovas - avatar
12th Apr 2019, 7:13 AM
viktoras ciumanovas
viktoras ciumanovas - avatar
+ 1
I see now, that makes sense. Thus the initial thought was right- it’s an issue with the task/challenge. “The case is closed” :) Thanks guys for your support!
12th Apr 2019, 7:39 AM
viktoras ciumanovas
viktoras ciumanovas - avatar