Floating Point Numbers in Python
Python also has floating point numbers, where the integer and fractional parts are separated by a period:
num = 0.5
print(num) # 0.5
All mathematical operations can be performed on such numbers. Let's add two floating point numbers:
res = 0.5 + 0.5 # 1.0
print(res)
Write the number 1.5
into the variable num1
, and the number 0.75
into the variable num2
. Find the sum of the values of these variables and output it to the console.
The following numbers are given:
num1 = 3.4
num2 = 8.27
num3 = 1.5
Subtract the first number from the second number, then multiply the result by the third number.