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


Topic: Python Program to Check if a Number is Positive, Negative or 0

Solution

num = float(input("Enter a number: "))
if num > 0:
   print("Positive number")
elif num == 0:
   print("Zero")
else:
   print("Negative number")
 # Python Program to Check if a Number is Odd or Even
 num = int(input("Enter a number: "))
if (num % 2) == 0:
   print("{0} is Even".format(num))
else:
   print("{0} is Odd".format(num))



List all Python Programs