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

9 lines
333 B
Python

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)))