How I can round numbers? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
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 Réponses
+ 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