<filename>p2.py
'''2. To find all prime numbers within a given range.'''

'''
    Prime number ->
    A number is greater than 1 is called a prime number,
    if it has only two factors, namely 1 and the number itself.
'''

def check_prime(num):
    ''' check if num is Prime or not '''
    
    if num > 1:
        is_prime = True             # assuming the number is prime number
        for i in range(2, num):     # looping between 2 and num
            if (num % i) == 0:      # if number (i) completely divides num, then num is not a prime no.
                is_prime = False    # if any no (i) can divide num, it means it isn't prime
        return is_prime             # else it is prime
    return False                    # if number is less than 1 return False.


if __name__ == '__main__':

    print("Enter the lower limit: ")
    lower_limit = int(input())

    print("Enter the upper limit: ")
    upper_limit = int(input())

    for num in range(lower_limit, upper_limit):
        if check_prime(num) == True:
            print(num)

<filename>p2.py
'''2. To find all prime numbers within a given range.'''

'''
    Prime number ->
    A number is greater than 1 is called a prime number,
    if it has only two factors, namely 1 and the number itself.
'''

def check_prime(num):
    ''' check if num is Prime or not '''
    
    if num > 1:
        is_prime = True             # assuming the number is prime number
        for i in range(2, num):     # looping between 2 and num
            if (num % i) == 0:      # if number (i) completely divides num, then num is not a prime no.
                is_prime = False    # if any no (i) can divide num, it means it isn't prime
        return is_prime             # else it is prime
    return False                    # if number is less than 1 return False.


if __name__ == '__main__':

    print("Enter the lower limit: ")
    lower_limit = int(input())

    print("Enter the upper limit: ")
    upper_limit = int(input())

    for num in range(lower_limit, upper_limit):
        if check_prime(num) == True:
            print(num)

2. To find all prime numbers within a given range. Prime number ->     A number is greater than 1 is called a prime number,     if it has only two factors, namely 1 and the number itself. check if num is Prime or not # assuming the number is prime number # looping between 2 and num # if number (i) completely divides num, then num is not a prime no. # if any no (i) can divide num, it means it isn't prime # else it is prime # if number is less than 1 return False.