KnowledgeBoat Logo
|

Computer Science

Write a program to check if the number is positive or negative and display an appropriate message.

Python

Python Control Flow

1 Like

Answer

number = int(input("Enter a number: "))
if number > 0:
    print("The number is positive.")
else:
    print("The number is negative.")

Output

Enter a number: 4
The number is positive.

Enter a number: -6
The number is negative.

Answered By

2 Likes


Related Questions