Project Level 1: Beginner
This project is designed for beginner learners who are still learning and practicing Python fundamentals.
Project Description
Create a simple program that checks if a given number is positive, negative, or zero.
Expected Output
Any time the program is executed, it prints out different messages based on the number sign:
Learning Benefits
Conditional Statements: Practice using
if-elif-else
statements to make decisions based on conditions.Input and Output: Practice taking user input and displaying output to the console.
Comparison Operators: Utilize comparison operators like
>
,<
, and==
to compare numbers.
Prerequisites
Required Libraries: No libraries are needed for this project.
Required Files: No files are needed for this project.
IDE: You can use any IDE on your computer to code the project.
Danger Zone
Once you code the project, compare it with our two solutions given in the button below.
user_number = input("Enter a number:")
number=int(user_number)
if number > 0:
print("The number is positive")
elif number < 0:
print("The number is negative")
else:
print("The number is zero")