“Hello World” is the first program you write whenever you are learning a new language. This introduces you to the basic syntax of any language and will also teach how to compile and run the program.
This article is for Python learners who are starting their Python learning journey. We are going to write the “Hello, World” program.
Hello World Program in Python
This is a basic and easy program. So, you do not need any IDE to write it. Even a normal text editor like Notepad or Notepad++ should do the job. For complex programs, IDE like PyCharm will definitely help.
Now, let’s go ahead and write the program.
First, Open the terminal and run the below command which starts the nano editor and opens the hello_world.py file in edit mode.
$ nano hello_world.py
Python provides the print() function which prints the specified message(passed as argument) to the screen or other standard output devices.
Write below python source code in the file, save, and exit.
print("Hello, World")
Next, use the python3 <name of file> command to run this script.
$ python3 hello_world.py Hello, World
The output is printed as Hello, World on the terminal.
Summary
Python is a feature-rich language and you are definitely going to love it. Congrats on writing your first Python program and all the best for learning.
I hope you liked this post. Thanks for reading. Please share and subscribe to this post and help us grow.