For formatted output use function format.
- For example, to print only 2 decimal digits of the number 1232.566777 use the
following statement:
print(format(1232.566777, '.2f'))
- For example, to print only 4 decimal digits of the number 1232.566777 use the
following statement:
print(format(1232.566777, '.4f'))
Practice: Chapter 2, Programming Exercises 2, 3, 4, 5, 6, 7
Assignment: Chapter 2, Programming Exercise 8