BeginnersBook

  • Home
  • Java
    • Java OOPs
    • Java Collections
    • Java Examples
  • C
    • C Examples
  • C++
    • C++ Examples
  • DBMS
  • Computer Network
  • Python
    • Python Examples
  • More…
    • jQuery
    • Kotlin
    • WordPress
    • SEO
    • JSON
    • JSP
    • JSTL
    • Servlet
    • MongoDB
    • XML
    • Perl

Python Program to Check if a Number is Positive Negative or Zero

Last Updated: January 8, 2018 by Chaitanya Singh | Filed Under: Python Examples

This Python program checks if the number(entered by user) is positive, negative or zero.

Python code

The user is asked to enter the number, the input number is stored in a variable number and then we have checked the number using if..elif..else statement.

# User enters the number
number = int(input("Enter number: "))

# checking the number
if number < 0: print("The entered number is negative.") elif number > 0:
    print("The entered number is positive.")
elif number == 0:
    print("Number is zero.")
else:
    print("The input is not a number")

Output:
Python program to check positive negative zero

Related Posts:

  1. Python program to check Leap Year
  2. Python program to check if number is prime or not
  3. Python Program to check even or odd number
  4. Python Program to add two numbers
  5. Python program to check if input character is vowel or consonant

Top Related Articles:

  1. Python Program to Check Vowel or Consonant
  2. Python Program to Check If number is Even or Odd
  3. Python Program to Convert Decimal to Hexadecimal
  4. Python Program to Convert Celsius To Fahrenheit and Vice Versa
  5. Python Program to Convert Decimal to Binary

About the Author

I have 15 years of experience in the IT industry, working with renowned multinational corporations. Additionally, I have dedicated over a decade to teaching, allowing me to refine my skills in delivering information in a simple and easily understandable manner.

– Chaitanya

Leave a Reply Cancel reply

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

Copyright © 2012 – 2025 BeginnersBook . Privacy Policy . Sitemap