Python - How to Multiply Floats
Multiplying floats in Python is easy. You just multiply them the same way you would integers. The result will be a float. It works completly intuitively. For example in the following code snippet we multiply to float variables ‘a’ and ‘b’ which results in ‘c’ which is also a float.
a = 12.4 b = 5.24 c = a * b print(c)
If you like you can also print out the type for each variable involved. This confirms that they are all floats and that it works exactly as you would expect.
a = 12.4 b = 5.24 c = a * b print(type(a),type(b),type(c)) print(c)