Social Sciences, asked by bruhmomentv32, 10 months ago

someone plssss help

9.2.5: Divisible by 3 (Python)

Instructions:
Write a program that creates a list of Booleans.
The list should tell which numbers, 1-10, are divisible by 3.

For example, if the number is 2, the Boolean should be False.
If the number is 3, the Boolean should be True.

Print out the resulting list.
Make sure you are using a list comprehension!


My code so far:
numbers = [3 % x for x in range(1, 4)]
print numbers

pls help thx

Answers

Answered by jameskorec
6

Answer:

numbers = [ x % 3 == 0 for x in range(1, 10) ]

print(numbers)

Explanation: that will get you somewhere

Similar questions