Write a Python Program to Check if a Number is Positive, Negative or 0 ?

Python Program to Check if a Number is Positive, Negative or 0 by Nested if

num = float(input("Enter a number: ")) if num >= 0: if num == 0: print("Zero") else: print("Positive number") else: print("Negative number")


Output:

Enter a number: 5 Positive number

Recent Posts

See All

Python Program to add Two numbers

Program: num1 = int (input(" Please Enter the First Number: ")) num2 = int (input(" Please Enter the second number: ")) sum = num1+num2 print('The sum of {0} and {1} is {2}'.format(num1, num2, sum)) O