Introduction: Simple Python "Number Checking" Program


Welcome! The following instructions will provide you a step by step guidance for creating simple program to check if a given number is positive, negative, or zero using the Python coding language. This instruction set is designed to help people who are just getting into the world of Python create a helpful, simple program for both practice and practicality. This instruction set is easy to follow, and visual aids will be provided after each step to ensure they are easy to follow. If you are struggling or can’t figure it out, there will be a template provided at the end of the tutorial with the completed code and an explanation of what each line of code does and how it works.


This instruction set solely uses the programming language ‘Python”. If you don’t already have python or if you don’t know how to set up python, please follow this short and easy tutorial ( or use the link ( to download the latest version of python directly and follow the given instructions. For this tutorial, we will be using the latest release of Python: Version 3.7 Your python may look a little different than mine, I am using custom colors.

Step 1: Running IDLE and Creating a New Python File

Create a new file within the Python IDLE application by opening Python IDLE. To open IDLE and create a new file, navigate to your windows button, type in “IDLE” and open the application named IDLE (Python 3.7). Once the application is open, navigate to File and click New File. Name the file whatever you wish.

Step 2: Defining a Function

Once the file is created, you will have a blank, editable IDLE environment. First, we must create a defined function. For my example, I will create a function named “test”, but you can name yours whatever you want. Each function needs a name and a type of variable to pass through it (a number in this case). To create a function, we type def test (num):

Step 3: First "if" Statement

Now we will create a simple “if” statement to check if the inputted number is positive. For this if statement to work, or any “if” statement to work, it must be under your function and indented once by tapping the “TAB” key once. My if statement will be written as if num > 0:

Step 4: First "Print" Statement

Now, we need a “print” statement to let the user know if the number IS IN FACT positive. I will achieve this by writing print("Positive")

DISCLAIMER: In order for the “print” statement to work, or any statement under an “if” calculation, it must be indented TWICE (Two “TAB” keys)! (See visual aid if confused)

Step 5: Second 'If" Statement

Now, we repeat step 3 but we change the “if” statement to check if the number is zero. I will do this by changing if num > 0: to if num == 0:WARNING - you must use TWO equal signs in your new “if” statement

Step 6: Second "Print" Statement

Once again, we will repeat the “print” statement but with a changed value. Here is the new print statement print("Zero")

Step 7: Third and Final "If" Statement

Finally, we will be repeating our “if” statement once again, but as you guessed, we will now test for a negative number. We do this by typing if num < 0:

Step 8: Our Last "Print" Statement

And now our last “print” statement. We will now let the user know if the inputted number IS IN FACT negative by adding print(“Negative”) within our last “if” statement

Step 9: Now We Save and Test Our Python Program

Now we’re ready to test our new Python program. Press CTR+S to save the file, name it however you like, and now click the RUN tab, and select RUN MODULE

Step 10: Run the Tests

We test our program by typing test(VALUE) in the module, then hit enter. VALUE can be replaced with any number you’d like as shown in the visual aid

Step 11: Congratulations!

Congratulations! You have now completed your Python program that tests whether a number is positive, negative, or zero! If you struggled or could not figure it out please retry the steps and try to crack it. If you are absolutely stuck, a completed program is provided here with an explanation of what each line of code does (But try to figure it out!)


Step 12: Troubleshooting Guide

Common problems:

- Spacing issues! (Check to make sure your “def” statement is not indented at all. “If” statements should be indented once, and “print” statements should be indented twice (Indent = ONE TAB).

- Spelling! Check to make sure you spelled all your variables correctly.

- Not running your program in “Module” mode!If you completed the program correctly, but it won’t run, make sure you’re running it using the “Run Module” button.

- Are you using the right run statement to check your program? To check if your program works, you must input “test(VALUE” in the module. “VALUE” MUST be replaced with a number Example - test(5)

Thank you for taking the time to complete this tutorial on how to create a simple program to check if a given number is positive, negative, or zero using the Python coding language. I welcome all feedback!