1234. Once the value of i is 5, it will break out of if loop. Else statement is anyways executed if the primary statement(for in this case) is not executed. Btw, good question. Many think else cannot be used with for :-)


Thanks Prem Prakash for you reply. I will try posting questions like this in future.


>>> for i in [1,2,4,3,5]: ... if i==5: ... break ... print(i) ... else: ... print("Logical Python") ... 1 2 4 3


Correct. Mistakenly you shuffled order but your answer is correct.


B The output of this code appears four times as "Logical Python." This corresponds to elements 1, 2, 3, and 4 of the list. Logical Python Logical Python Logical Python Logical Python


Thanks Yukihiro. You are right. it will print 1 2 3 4.


Thank you for your attempt, though the correct answer is B.


Interesting Question. B is the answer


The correct answer is B (1234) because we print the first 5 elements in the list [0-4]. So we print first fourth number


Thanks Joaquim. You are right.


Thanks cambo. You are right.


Thanks Kurippusu. You are right.


United States الاتجاهات
Loading...

Something went wrong.


Something went wrong.