Write a program to find no. Is positive or negative in python
Answers
Answered by
3
Explanation:
# In this python program, user enters a number and checked if the number is positive or negative or zero.
num = float(input("Enter a number: "))
if num > 0:
print("Positive number")
elif num == 0:
print("Zero")
else:
print("Negative number")
Answered by
11
The following codes will have to be typed in script mode, saved and then executed.
Here, we'll be using the IF - ELSE function. It is a function that decides the result based on a given condition.
It will run the body of the code, only if the condition is true. Otherwise, the 'else' code of the value inputted will be executed.
CODE:
num = int(input("Enter a number:"))
if num>0:
print("The number is positive.")
else:
print("The number entered is negative.")
OUTPUT:
Attachments:


Similar questions