= 5.026 A B = 5.000 # two decimals method # . 1, round (NUM, n-) Print (round (A, 2)) # 5.03, the obtained is a float type # 2,% Method Print (float ( ' % .2f ' % a)) # 5.03, the obtained is a float type # . 3, Print ( ' {X: .2f} ' .format (X = a)) # 5.03, this is obtained str