How to print the square root of 1 as 1.000 in python? I have seen a lot of similar questions in this cite, but none of them, as I checked, was my question.
Thanks.
Well, there are several ways. One is:
from math import sqrt
print("%.3f" % sqrt(1))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.