Vidyalelo
Python · Q70

Python Lists MCQs: Exam Practice for List Concepts

Programming · Python · question 70

Q70

Write a list comprehension equivalent for the Python code shown below. for i in range(1, 101): if int(i*0.5)==i*0.5: print(i)

A.
[i for i in range(1, 100) if int(i*0.5)==(i*0.5)]
B.
[i for i in range(1, 101) if int(i*0.5)==(i*0.5)]
Answer
C.
[i for i in range(1, 101) if int(i*0.5)=(i*0.5)]
D.
[i for i in range(1, 100) if int(i*0.5)=(i*0.5)]

Answer: Option B

Solution

Answer: Option B
No explanation is given for this question Let's Discuss on Board