Hello world program in python.

In the first post, we have checked how to view python version available on our system.

From this post, we will start learning python programming.

The first ever thing we learn when learning a new programming language is the Hello World program.

Today we will see how to create “Hello world” program in python.

1. Create a new script with “.py” extension denoting python script.

user@ngelinux$ vim first.py

user@ngelinux$ cat first.py 
print("Hello, World!")

2. Make the script executable.

user@ngelinux$ chmod +x first.py 
user@ngelinux$ 

3. Run the script with python interpreter.

user@ngelinux$ python first.py 
Hello, World!

user@ngelinux$ python3 first.py 
Hello, World!
user@ngelinux$ 

Here we used the command “print” and entered the text we want to print inside the braces “()”.

Leave a Reply

Your email address will not be published.