Vidyalelo
Python · Q83

Python Lists MCQs: Exam Practice for List Concepts

Programming · Python · question 83

Q83

Write a list comprehension for producing a list of numbers between 1 and 1000 that are divisible by 3.

A.
[x in range(1, 1000) if x%3==0]
B.
[x for x in range(1000) if x%3==0]
Answer
C.
[x%3 for x in range(1, 1000)]
D.
[x%3=0 for x in range(1, 1000)]

Answer: Option B

Solution

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