ungleich-learning-circle/youngjin.han/python-the-hard-way/ex3-1.py

10 lines
333 B
Python
Raw Normal View History

2020-05-18 14:32:23 +00:00
f_pi = 3.14159265358979
print("org =", f_pi)
print("trans format 1 = %.2f" % f_pi)
print("trans format 2 =", round(f_pi, 2))
print("trans format 3 = %.2f" % round(f_pi, 2))
print("trans format 4 = {:.2f}".format(f_pi))
print("trans format 5 = {:.2f}".format(round(f_pi, 2)))
print("trans format 6 = {:.15f}".format(round(f_pi, 2)))