Create a user-defined function to input a number from user and check whether the entered number is positive or negative.
Answers
Answered by
0
Answer:
In python3:
x = int(input("Please enter the number"))
pos = "positive number"
neg = "negative number"
zero = "zero"
def check_num(num):
if num > 0:
return pos
elif num < 0:
return neg
else :
return zero
res = check_num(x)
print("The entered number is " + res)
Similar questions