What I have so far:
num = range(0, 101, 3)
list = []
if num % 3 == 0:
list.append
print(list)
What I have so far:
num = range(0, 101, 3)
list = []
if num % 3 == 0:
list.append
print(list)
I think this is what you are trying to do:
print("\n".join(str(i) for i in range(0, 101, 3) if i % 2 == 0))
or
print([i for i in range(0, 101, 3) if i % 2 == 0])
I am using a list comprehension here.
print(list(range(0, 101, 6)))
does the same thing however.
lst = [] # don't use Python inbuilt names for variables
for num in range(0,101,3):
if num % 2 == 0: # you already go through the numbers in steps of 3
lst.append(num)
print(lst)