Q:

Display float number with 2 decimal places using print() using Python programming

0

Display float number with 2 decimal places using print()

Given:

num = 458.541315

Expected Output:

458.54

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Hint:

Use the %.2f formatting code in print() function to format float number to two decimal places.

Solution:

num = 458.541315
print('%.2f' % num)

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now