Guys, how can I make the answer print out as a list. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Guys, how can I make the answer print out as a list.

''' Code to find numbers divisible by 7 but not a multiple of 5 between 2000 and 3200 ''' for i in range(2000,3201): if i%7==0 and i%5!=0: print(i,end=',')

12th Jun 2017, 12:28 PM
Masquerade
Masquerade - avatar
3 Answers
+ 2
create a empty list, append every i that fulfills your conditions and last step print the list. code: list = [] for i in range (2000,3201): if i%7 == 0 and i%5 != 0: list.append (i) print(list)
12th Jun 2017, 1:00 PM
Amarie
+ 1
just have i in print e.g print(i)
12th Jun 2017, 12:49 PM
Lord Krishna
Lord Krishna - avatar
+ 1
aah! Got it, thanks a lot.
12th Jun 2017, 1:04 PM
Masquerade
Masquerade - avatar