Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python program to print prime numbers in an interval

lower = 800
upper = 900
print("Print the number's from ",lower," and ",upper,".")
for num in range(lower,upper + 1):
  if num > 1:
    for i in range(2, num):
      if (num % i) == 0:
        break
    else:
      print(num)    
Comment

python code to print prime numbers

# Thanks to https://www.codegrepper.com/profile/farid
# Just tune his answer into easy to use function

def prime_numbers(start_num, end_num):
    for number in range(start_num , end_num + 1):
        is_prime = True
        for counter in range(2,number):
            value = number % counter
            if value == 0:
                is_prime = False
                break
        if is_prime == True:
            print(number)
Comment

PREVIOUS NEXT
Code Example
Python :: current time python 
Python :: python update installed packages 
Python :: how to remove arrays in python from a specific place 
Python :: how to read a text file from url in python 
Python :: how to get location using python 
Python :: add whitespaces between char python 
Python :: tkinter button foreground color click 
Python :: escape brackets in f string 
Python :: remove empty lines from file python 
Python :: generate sha1 python 
Python :: how to do md5 hASH IN PYTHON 
Python :: python trie 
Python :: install pip with pacman linux 
Python :: python pd.DataFrame.from_records remove header 
Python :: python subprocess with environment variables 
Python :: calculate nth prime number python 
Python :: Getting the Current Working Directory in Python 
Python :: how to remove b in front of python string 
Python :: python version command 
Python :: python obtain data from pandas dataframe without index name 
Python :: python numba 
Python :: get first x characters of string python 
Python :: python get dictionary keys 
Python :: how to convert types of variablesin python 
Python :: Row wise mean pandas 
Python :: upload py file using flask 
Python :: write results in csv file python 
Python :: get first line of file python 
Python :: pass variable in subprocess run python 
Python :: python mp4 to mp3 
ADD CONTENT
Topic
Content
Source link
Name
6+3 =