So far, we already installed python in our system. Click here to install python. Now it’s time get your hands dirty with python. In this post I am going to show you how you can create your first python hello world program.
For better understanding please follow this blog post with my video tutorial which is given below.
What is our First Project?
As this is our first project, let it be simple. It is a very simple program which only greet hello to the world. Let’s start 🙂
Python actually comes with an IDLE (Integrated DeveLopment Environment). Click here to learn more about IDLE. Python IDLE automatically install with the python so you do not need to install it explicitly. Simply go to the start menu and search for IDLE and run it. IDLE is used to run the python code. Press Ctrl+N to open a new text editor from IDLE. Now write your python code in the new file and save the file where you want to save it with any name.
This is the code for our first program to greet the world and print the message to the screen. I am using Python3.
That’s it, this is the code for our program. This one line is sufficient if we want to print something on the screen.
print() is a python function, we will learn more about functions later in this course. Till then just remember to display something on our computer screen we use print() function in python.
Now, how you can tell the print function what to display on the screen. To tell the print function what to display simply write your message inside the parenthesis(brackets) surrounded with the quotation marks.
Note: If you does not pass a message to the print function then it will print a blank line.
Testing the Program
To test your first program, is it actually works or not. Press F5 in your python file to run the code. If everything works fine then it will print your message in the python IDLE with the given message you provided inside the parenthesis(brackets) in your code. Otherwise, if any error comes up comment it below or feel free to reach me via my social handles.