In Python, you can define the type of a variable. The built-in function is used for this. type:
name = "Ivan"
print(type(name))  # <class 'str'>
n = 5
print(type(n))  # <class 'int'>
r = 5.0
print(type(r))  # <class 'float'>

The value 5.0 is a number represented as a decimal fraction (has an integer and fractional part). In computer science, such numbers are called real
A real number is a number in which there is an integer and fractional parts. The integer and fractional parts are separated by a dot

Even if the fractional part of the number is zero, as in the r variable in the example, the translator will still create a real variable in memory. The point, as it were, is a signal for the translator that it is necessary to create a real variable.
Very large and very small numbers are written using a "floating point" (in the so-called scientific format).
In a scientific format, the number is represented in the form of a mantissa (a significant part of the number) and order. When recording, the mantissa and the order are separated from each other by the letter e (denotes 10 to some extent).
For example, you can save the value of the electron charge in a variable ( \(1,60217662 \times 10^{-19}\) Cl), writing as follows
El = 1.60217662e-19 #for a positive order, the + sign can be omitted
Almost all real numbers cannot be stored in computer memory with perfect accuracy, since a limited number of bits are allocated for their storage. Therefore, in calculations with real numbers, errors associated with inaccuracy of the representation are accumulated. Moreover, the less space is allocated, the greater this error will be.

Input

In order to enter a real number using the input () function, it is necessary to convert the character string (which is the result of the function \(input()\)) into a real number using the function \(float()\):
x = float(input())
If you need to enter several values from one line at once, then we use the same method as for integers:
x, y = map(float, input().split())

Output

When outputting real numbers, 16 decimal places are displayed by default. This format is not always necessary. If you want to reduce the output format, then format output is used. To do this, the format method is applied to the string that we want to output. And inside the line formats are written in braces after the colon
Example:
x=1/6
print("{:f}".format(x))  # format f prints 6 digits in fractional part by default
print("{:.3f}".format(x)) # .3 indicates that it is necessary to print 3 characters after the period
print("{:12.4e}".format(x)) #12.4 - the first number (12) specifies the total number of positions to display the number, the second (4) - the number of digits in the fractional part. Format e - displays a number in scientific format
The screen displays
0.166667
0.167
  1.6667e-01

When working with real numbers, you can use the familiar math module, which contains a large number of built-in functions.
When solving problems, one often has to round real numbers to the nearest integer values. There are two functions for this.

REMEMBER
1
function int (x) - discards the fractional part of the real number x
2 function round (x) - rounds the real number x to the nearest integer (if the fractional part of the number is 0.5, then the number is rounded to the nearest even number)

Приведем наиболее полезные функции, содержащиеся в модуле math.
Функция Описание
Округление
int(x) Rounds a number to zero. This is a standard function, you do not need to connect the math module to use it.
round(x) Rounds a number to the nearest integer. If the fractional part of a number is 0.5, then the number is rounded to the nearest even number.
round(x, n) Rounds the number x to n characters after the period. This is a standard function, you do not need to connect the math module to use it.
floor(x) Rounds the number down: floor(1.5) == 1floor(-1.5) == -2
ceil(x) Rounds the number up: ceil(1.5) == 2ceil(-1.5) == -1
abs(x) Module (absolute value). This is a standard feature.
Корни, логарифмы
sqrt(x) Square root. Using: math.sqrt(x).
Example:
print(math.sqrt(4))
output: 2.0
log(x) The natural logarithm. When called as math.log(x, b) returns base b logarithm.
e The base of natural logarithms e = 2,71828...
Тригонометрия
sin(x) The sine of the angle given in radians
cos(x) The cosine of the angle given in radians
tan(x) Radius tangent
asin(x) Arcsine, returns a value in radians
acos(x) Arccosine, returns the value in radians
atan(x) Arc tangent, returns the value in radians
atan2(y, x) Polar angle (in radians) of the point with coordinates (x, y).
degrees(x) Converts an angle specified in radians to degrees.
radians(x) Converts an angle specified in degrees to radians.
pi Constant π = 3.1415...

When working with real numbers, you can use the familiar math module, which contains a large number of built-in functions.
When solving problems, one often has to round real numbers to the nearest integer values. There are two functions for this.

REMEMBER
1
function int (x) - discards the fractional part of the real number x
2 function round (x) - rounds the real number x to the nearest integer (if the fractional part of the number is 0.5, then the number is rounded to the nearest even number)

Приведем наиболее полезные функции, содержащиеся в модуле math.
Функция Описание
Округление
int(x) Rounds a number to zero. This is a standard function, you do not need to connect the math module to use it.
round(x) Rounds a number to the nearest integer. If the fractional part of a number is 0.5, then the number is rounded to the nearest even number.
round(x, n) Rounds the number x to n characters after the period. This is a standard function, you do not need to connect the math module to use it.
floor(x) Rounds the number down: floor(1.5) == 1floor(-1.5) == -2
ceil(x) Rounds the number up: ceil(1.5) == 2ceil(-1.5) == -1
abs(x) Module (absolute value). This is a standard feature.
Корни, логарифмы
sqrt(x) Square root. Using: math.sqrt(x).
Example:
print(math.sqrt(4))
output: 2.0
log(x) The natural logarithm. When called as math.log(x, b) returns base b logarithm.
e The base of natural logarithms e = 2,71828...
Тригонометрия
sin(x) The sine of the angle given in radians
cos(x) The cosine of the angle given in radians
tan(x) Radius tangent
asin(x) Arcsine, returns a value in radians
acos(x) Arccosine, returns the value in radians
atan(x) Arc tangent, returns the value in radians
atan2(y, x) Polar angle (in radians) of the point with coordinates (x, y).
degrees(x) Converts an angle specified in radians to degrees.
radians(x) Converts an angle specified in degrees to radians.
pi Constant π = 3.1415...