Introduction
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:
At the output we get the result:
The print() statement performs the function of outputting data to the console.
Let's create a file with Vim:
And add a one-line code:
To run the program itself, run the command:
Consider also the use of variables in code and the use of print() to print information from variables:
a = "Hello,"
b = " World!"
print(a+b)
At the output we get the result:
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
print(a*b)
We get the following result:
28.0
Conclusions
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: