Round-off decimal points in Python

Nice trick i found in python. Lets say you want to round off(truncate) huge float numbers. e.g. 8.574748485950The command used is “round” x = 5.75845848484r = round (x,5) # 5 is the number of digits you want to keep after the decimal point.print r#Result : 5.75846 # r = round (x,2) print r# This would …

Round-off decimal points in Python Read More »