+ 3

How do you round a number in python?

I've seen this in many easy python coding challenges here on sololearn

30th Aug 2020, 5:06 AM
schrodingersdumbass
2 Antworten
+ 8
round(55.55) => 56.0 round(55.55,1) => 55.6 round(55.55,-2) => 100.0
30th Aug 2020, 8:14 AM
Namit Jain
Namit Jain - avatar
+ 5
Simple using round function Ex:- round(5.55) Or if you want to round till nth position after decimal Use round(5.5555,2) here second parameter will define the nth position
30th Aug 2020, 5:08 AM
Ayush Kumar
Ayush Kumar - avatar