How can I delete 2 and 3 from the composite numbers list in this Assignment? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How can I delete 2 and 3 from the composite numbers list in this Assignment?

https://code.sololearn.com/cu2Kpee2JMga/?ref=app

4th Dec 2018, 5:55 PM
🍇 Alex Tușinean 💜
🍇 Alex Tușinean 💜 - avatar
3 Answers
+ 13
Try this: #input a number and see what happens. a=int(input()) b=list(range(1 , a)) if (a%2==0 or a%3==0) and (a!=2 and a!=3): print(str(a)+ ' is a composite number.') else: print(str(a)+' is not a composite number.') print('__________________________________') print('All composite Numbers from 1 to '+ str(a)) for k in [i for i in b if i!=2 and i!=3]: if a%2==0 or a%3==0: print(k) #This code show you all composite numbers from the given range.
4th Dec 2018, 6:53 PM
Uni
Uni - avatar
+ 12
You're welcome 💧Alex Tusinean🔥 😆😆
4th Dec 2018, 7:01 PM
Uni
Uni - avatar
+ 3
Thank you!😀
4th Dec 2018, 7:00 PM
🍇 Alex Tușinean 💜
🍇 Alex Tușinean 💜 - avatar