How I can round numbers? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How I can round numbers?

I know i can use round() but I want to round 64 to 60 or 90 to 100. How i can do this?

19th Feb 2021, 11:33 PM
Bartosz Bryniak
Bartosz Bryniak - avatar
2 Answers
+ 3
Bartosz Bryniak Use negative numbers on second argument. print(round(64, -1)) >> 60 print(round(90, -2)) >> 100
20th Feb 2021, 2:49 AM
noteve
noteve - avatar