a) [x in range(1, 1000) if x%3==0]
b) [x for x in range(1000) if x%3==0]
c) [x%3 for x in range(1, 1000)]
d) [x%3=0 for x in range(1, 1000)]
Write a list comprehension for producing a list of numbers between 1 and 1000 that are divisible by 3.
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
Write a list comprehension for producing a list of numbers between 1 and 1000 that are divisible by 3.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!