+ 1

# I tried to make a simple python code to print prime numbers but it is not working as I expected can someone help please

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

18th May 2020, 1:35 PM
Ashraf Vp
+ 1
Please be clear for you want to print all prime numbers in a range or want to check if a given number is prime. Also keep in mind that a number is prime if it is divisible no number other than itself and 1.
18th May 2020, 1:39 PM
Pulkit Kamboj
0
How do I do that
18th May 2020, 1:40 PM
Ashraf Vp
0
18th May 2020, 1:45 PM
Pulkit Kamboj
0
Yes
18th May 2020, 1:46 PM
Ashraf Vp
0
So I should do for I in range(10)
18th May 2020, 1:46 PM
Ashraf Vp
0
def isprime(n): for i in range(2,n): if(n==1) return false if(n==2): return true if(n%i==0):#if number is divisible by any of these return false return false return true print(isprime (n))
18th May 2020, 1:50 PM
Pulkit Kamboj
0
You may not be clear with the code I guess, I would recommend you start learning from the course and I think they have taught this program
18th May 2020, 1:55 PM
Pulkit Kamboj
0
50Legendary Remnant, this question is about the same as your last one. Please ask each question only once. Also, in this linked code, you have only written what Abhay posted and then deleted. Where's your own failed attempt which you have been talking about before? https://www.sololearn.com/Discuss/2300368/?ref=app
18th May 2020, 1:56 PM
HonFu
0
I did post it here
18th May 2020, 2:04 PM
Ashraf Vp
0