+ 6
Is the answer to this question valid? as >>> a [3] is supposed to be = 4
Please note that the sign ( « ) isn't originally in the code, it is, to specify my interest. QUESTION: Fill in the gap to print Hello world ! a = [ 1, 2, 3, 4] a [ ] « = 2 If 4 in a : Print( "Hello world !") else: Print("Goodbye world") ANSWER: a = [ 1, 2, 3, 4] a [ 3 ] « = 2 If 4 in a : Print( "Hello world !") else: Print("Goodbye world") I thought that if we wanted to know the position of [3] in the list, we should use a.index(3) instead . Pls anyone? Explain this. Maybe i'm wrong on my part, i need to understand .
7 Respostas
+ 6
Ok thanks a lot~ swim ~
This isn't the only question like this, I've been losing challenges because of this, and i prefer understanding the question to learning it the way it is.
+ 4
That's exactly what I'm complaining about. The output should be "Hello world !" , but 4 in a is replaced as 2 because a [3] = 2. So it will print "Goodbye world" instead, this question should be removed from the py quiz or corrected, such that the question will state: Fill in the gap to print "Goodbye world" instead of "Hello world"
+ 4
I didn't
I was just checking through correct answers after a challenge, and i saw 3 in empty space as the answer
left for me i'll put 1 in the empty space