Horje
python program to find all prime numbers within a given range Code Example
python program to find all prime numbers within a given range
rng = int(input("please enter lowest number: "))
RNG = int(input("please enter higest number: "))
listofprime = []

def primecheck(x):
    flag = True
    for i in range(2, x):
        if (x % i) == 0:
            flag = False
            break
    if flag:
       listofprime.append(x)


for x in range(rng, RNG):
     primecheck(x)
print (listofprime)
print ("there are ",len(listofprime),"prime number between",rng,"and",RNG)
            

find prime number in given range in python
#not made by me but a person name "Concerned Cod" i put only input in it so it makes easy to copy-paste LOL
start = int(input("enter start range : "))
end = int(input("end range : "))
 
for i in range(start,end):
  if i>1:
    for j in range(2,i):
        if(i % j==0):
            break
    else:
        print(i)
the list of prime number in a given range python
n=int(input("Enter the number till you want to check: "))
primes = []
for i in range (2, n+1):
    for j in range(2, i):
        if i%j == 0:
            break
    else:
        primes.append(i)
print(primes)




Python

Related
python get webpage source Code Example python get webpage source Code Example
why is python hard Code Example why is python hard Code Example
how to add headers in csv file using python Code Example how to add headers in csv file using python Code Example
cross validation python Code Example cross validation python Code Example
korean to english Code Example korean to english Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7