For example, there is a task to calculate the length of the hypotenuse of a right triangle from its legs. Launch a text editor and write the following text:
a = 179
b = 197
c = (a**2 + b**2)**0.5
print(c)
Here we use variables - objects in which you can store various (numeric, string, and other) values. In the first line, the variable a is assigned the value 179, then the variable bis assigned the value 971, then the variable cis assigned the value of the arithmetic expression equal to the length of the hypotenuse.
After this, the value of the variable c is displayed on the screen.
Save this text in a file named hypot.py.
Launch a terminal, go to the directory where this file is located and run this program:
$python3 hypot.py
The Python language interpreter, launched with a file name, does not start in interactive mode, but executes the sequence of commands that is stored in the file. In this case, the values of the calculated expressions are not displayed on the screen (unlike the interactive mode), so in order to display the result of the program, that is, the value of the variable, c we need a special function print.