February 27, 2023
Updated February 27, 2023

First Python Program

Linux Ubuntu


The simplest Python program is to print a string saying Hello, World! Let's figure out how to write it. To do this, we need to install the latest version of Python on our system..

Preparing before starting

To get started, you need to expand virtual environment  in Python 3. You will also need to initial setup our server.

First program

Let's use the Python 3 command line:


Let's execute the command that displays information:

print("Hello, World!")

At the output we get the result:

Hello, World!

The print() statement performs the function of outputting data to the console.

Let's create a file with Vim:

vim TestFirstProgramm.py

And add a one-line code:

print("Hello, World!")

To run the program itself, run the command:

python3 TestFirstProgramm.py

Consider also the use of variables in code and the use of print() to print information from variables:

#Assigning values ​​to variables
a = "Hello,"
b = " World!"


At the output we get the result:

Hello, World!

Variables are assigned not only string data types, but also integer or floating point numbers.

In the following example, consider the multiplication of numbers using variables. Let's assign the value 5.60 to the variable "a" and the value 5 to the variable "b" and multiply them using the print(a*b) statement, according to the following code:

a = 5.60
b = 5


We get the following result:



As a result, we can say that writing the first program in the Python programming language is not difficult. There are various possibilities such as:

    • writing a module for projects;
    • creating classes inside modules;
    • defining a function within a class;
    • importing modules using the import statement.
5 out of 5
Аverage rating : 5
Rated by: 1
19703 Claymont 2093 Philadelphia Pike #2345, USA
+1 302 498-83-59
700 300
700 300
We use cookies to make your experience on the Serverspace better. By continuing to browse our website, you agree to our
Use of Cookies and Privacy Policy.