How to print two digits before the decimal with keeping the exponents? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to print two digits before the decimal with keeping the exponents?

I want to format my values from 2.97372e-16 to 29.737e-15. How can I do this in python? I have been playing with {:.2f} format but I cant get anyhere. Note. I dont want to round.

3rd Oct 2022, 9:46 PM
Rea Hi
2 Answers
+ 2
Show your attempts
3rd Oct 2022, 10:44 PM
Solo
Solo - avatar
+ 1
Rea Hi you might have to do the string formatting in a custom way. For inspiration, have a look at some of the codes posted here: https://www.sololearn.com/learn/10004/?ref=app
4th Oct 2022, 1:05 AM
Brian
Brian - avatar