+ 3
print (2e-3)
Hey Guys whenever we do print(2e-3) in python it shows output 0.002 can you Explain why ? https://code.sololearn.com/cyxdcIhSaEcm/?ref=app
2 Réponses
+ 3
I can explain.
In physics, when we have a number really big or small, we can write it in a condensed format : 2 000 000 is 2 * 10 ^(6) = 2 *10*10*10*10*10*10.
Same for small numbers:
0.000 02 which is 2 * 10 ^(-5) = 2/(10*10*10*10*10)
In the first example, we can (in python) use an even condensed format, with the syntax 2e6 instead of 2*(10^6),
and 2e-5 for the other one.
+ 7
When you write 2e-3 is the same like:
2*(10^-3) = 2*0.001 = 0.002
So: print(2e-3)=print(0.002)