Jan-01-2022, 11:39 PM
When I run this simple program 0.166666666666 is printed.
What do i do to make the print 0.17
i.e. what is the formatting command to truncate the string to two digits beyond the dec point??
What do i do to make the print 0.17
i.e. what is the formatting command to truncate the string to two digits beyond the dec point??
1 2 3 |
x = ( 1 / 6 ) s = str (x) print (s) |