Home » Programming Language (coding) » Python MCQ » What will be the output of the following Python code? >>>t = (1, 2, 4, 3, 8, 9) >>>[t[i] for i in range(0, len(t), 2)]

What will be the output of the following Python code? >>>t = (1, 2, 4, 3, 8, 9) >>>[t[i] for i in range(0, len(t), 2)]

What will be the output of the following Python code?

>>>t = (1, 2, 4, 3, 8, 9)
>>>[t[i] for i in range(0, len(t), 2)]

A. [2, 3, 9]
B. [1, 2, 4, 3, 8, 9]
C. [1, 4, 8]
D. (1, 4, 8)

Correct Answer: Option C. [1, 4, 8] 

Leave a Reply

Your email address will not be published. Required fields are marked *

Solve : *
19 + 12 =