Rounding numbers

Please support our Python advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Sep 2008
Posts: 379
Reputation: tomtetlaw is an unknown quantity at this point 
Solved Threads: 4
tomtetlaw's Avatar
tomtetlaw tomtetlaw is offline Offline
Posting Whiz

Rounding numbers

 
-1
  #1
Jun 28th, 2009
How would I round a number to the nearest multiple of 10?
...
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 12
Reputation: BigTurtle is an unknown quantity at this point 
Solved Threads: 2
BigTurtle's Avatar
BigTurtle BigTurtle is offline Offline
Newbie Poster

Re: Rounding numbers

 
1
  #2
Jun 28th, 2009
How about this: RoundedN = 10*int(round(N/10.0)) , where N can be integer or floating
Last edited by BigTurtle; Jun 28th, 2009 at 6:34 am. Reason: clarification
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 379
Reputation: tomtetlaw is an unknown quantity at this point 
Solved Threads: 4
tomtetlaw's Avatar
tomtetlaw tomtetlaw is offline Offline
Posting Whiz

Re: Rounding numbers

 
0
  #3
Jun 28th, 2009
Thanks!
...
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Python Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC