Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Prime numbers within given range in python

lower_value = int(input ('Please, Enter the Lowest Range Value: '))
upper_value = int(input ('Please, Enter the Upper Range Value: '))

print ('The Prime Numbers in the range are: ')  
for number in range (lower_value, upper_value + 1):  
    if number > 1:  
        for i in range (2, number):  
            if (number % i) == 0:  
                break  
        else:  
            print (number)
Comment

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)
Comment

PREVIOUS NEXT
Code Example
Python :: ordereddict 
Python :: date strftime python 
Python :: color python 
Python :: print statement in python 
Python :: how to sort list of dictionaries in python 
Python :: django id 
Python :: install tensorflow gpu 
Python :: how to compile python 
Python :: python input timeout 
Python :: pandas apply function to each row lambda 
Python :: pandas profile report python 
Python :: pygame window at center 
Python :: counter python 
Python :: Converting Hex to RGB value in Python 
Python :: beautiful soup 4 
Python :: random picker python 
Python :: pandas pass two columns to function 
Python :: python initialize empty dictionary 
Python :: create dictionary from string python 
Python :: python url shortener 
Python :: pandas read csv skip rows 
Python :: python call function from string 
Python :: how to aggregate multiple columns in pyspark 
Python :: check if point is inside polygon python 
Python :: python upper 
Python :: kivymd window size 
Python :: pytorch unsqueeze 
Python :: python pandas give column names 
Python :: print out a name in python 
Python :: sklearn support vector machine 
ADD CONTENT
Topic
Content
Source link
Name
6+7 =