+ 3
How can I delete 2 and 3 from the composite numbers list in this Assignment?
3 odpowiedzi
+ 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.
+ 12
You're welcome 💧Alex Tusinean🔥 😆😆
+ 3
Thank you!😀