

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to check if a number is positive, negative or zero using Python?
Using if-elif-else
num = float(input("Enter a number: ")) if num > 0: print("Positive ") elif num == 0: print("Zero") else: print("Negative ")
using nested if
num = float(input("Enter a number: ")) if num >= 0: if num == 0: print("Zero") else: print("Positive") else: print("Negative")
- Related Questions & Answers
- Check if a number is positive, negative or zero using bit operators in C++
- C program to Check Whether a Number is Positive or Negative or Zero?
- Program to check if a number is Positive, Negative, Odd, Even, Zero?
- Python Program to Check if a Number is Positive, Negative or 0
- C# Program to check if a number is Positive, Negative, Odd, Even, Zero
- Java Program to Check Whether a Number is Positive or Negative
- Check whether product of integers from a to b is positive, negative or zero in Python
- Java program to find if the given number is positive or negative
- How to Check if a Number is Odd or Even using Python?
- Sum a negative number (negative and positive digits) - JavaScript
- Python program to check if a number is Prime or not
- Check if a number is an Achilles number or not in Python
- How to check whether a number is prime or not using Python?
- JavaScript: How to check if a number is NaN or finite?
- Check if a number is Primorial Prime or not in Python
Advertisements