Q:

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

belongs to collection: Python Input and Output Exercises

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)

Accept a list of 5 float numbers as an input from ... >>
<< Convert Decimal number to octal using print() outp...