X
X
Xacker_Name2021-12-07 18:10:22
Python
Xacker_Name, 2021-12-07 18:10:22

What should I do with Python multiplication?

What to do, if:

a = 100
b = 0.00000028
c = a*b
print(c)


Outputs 2.8000000000000003e-05
-----
How to make it output 0.000028

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
alexbprofit, 2021-12-07
@rt2233

round(c, 6)

V
Vladimir Kuts, 2021-12-07
@fox_12

Alternative option:

from decimal import Decimal

a = Decimal('100')
b = Decimal('0.00000028')
c = a * b
print(c)

# 0.00002800

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question