Program to print negative numbers in the range using Python


In this section of python programming, we will understand the code to print negative numbers between the given range. The condition of a negative number is that the number should be less than 0.

Program to print negative numbers in the range


negative_list = []

n = int(input("Enter the lower bound of the list "))

m = int(input("Enter the upper bound of the list "))

# Check range

if n>0 and m>0:

    print("There is no negative numbers in the given range")


    for i in range(n, m+1):

        if i < 0:


    print("Negative numbers in the given range {0} and {1} using for loop are {2}".format(n, m, negative_list))


Program to print negative numbers in the range Output


In the above python code we have taken the range from the user and checked whether the start and end both are positive integers. If any of the range value is negative then, the negative numbers in the range given are appended in the list and displayed on the screen.


  • Barry Allen

    A Full Stack Developer with 10+ years of experience in different domain including SAP, Blockchain, AI and Web Development.

    View all posts


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.