Linked Questions

2 votes
3 answers
8k views

I have a this small task , where I am rounding up the number to higher multiple of ten. But want to round it to nearest multiple of ten. My code : import math a = map(int,list(str(7990442))) b = ...
Shivkumar kondi's user avatar
3 votes
4 answers
1k views

I basically want to know whether the result of my equation (which is a simple one like this x / y) was rounded up or down. The reason is that I have two simple statements after the rounding line like ...
Derp's user avatar
  • 33
1 vote
2 answers
3k views

I have been trying to round of any number to the nearest multiple of 5. By saying that, I mean that it should always round up. However, my piece of code is always to rounding off to the nearest ...
Mahir Islam's user avatar
  • 1,700
1 vote
2 answers
324 views

I got this number 1.12412 and I want to round it to 1.12415 or 1.12410 (muliple of 5 in last decimal) If using the Round(X,4) function I get 1.1241 (4 decimals). Is there a function that can make that ...
Raphael Hen's user avatar
0 votes
1 answer
444 views

I would like to write a specif rounding logic. number = x if x < 950: # round number to and in steps of 50 elif x < 9000: # round number to and in steps of 100 elif x < 100000: # ...
exec85's user avatar
  • 497
0 votes
3 answers
139 views

I want to round numbers down to the next 5 in python What I mean: 1 -> 0 3 -> 0 4 -> 0 5 -> 5 7 -> 5 9 -> 5 ... I already searched a lot for rounding numbers with a base but then ...
chraebsli's user avatar
  • 410
0 votes
1 answer
377 views

How do I round a fraction to the nearest 0.5 between 0.0 and 5.0? Let's say I've got 11/150, it should convert to 0.0. In addition, 75/150 should convert to 2.5 As for the code I've got this but I'm ...
Trent112232's user avatar
0 votes
0 answers
57 views

Is there a simple way to round in python to the nearest X value? For example, to round to the nearest tens I can do: >>> round(1845,-1) 1840 What about if I wanted to round to the nearest...?...
carl.hiass's user avatar
  • 1,814
0 votes
0 answers
23 views

Trying to round student grades to nearest multiple of five. If grade is two or less closer to the round then that grade gets used. What is wrong with my current code Grade = input(23) Round_grade = (((...
sez222's user avatar
  • 1
0 votes
0 answers
15 views

I'm using the def function and the for or the while loop to create a program that can find the nearest hundreds for a given number.
user avatar
41 votes
3 answers
39k views

Is there a function in Python that allows me to round down to the nearest multiple of an integer? round_down(19,10)=10 round_down(19,5)=15 round_down(10,10)=10 I conscientiously looked at SO and ...
The Unfun Cat's user avatar
0 votes
3 answers
13k views

Here is my code, in Python: x=float(raw_input('How many total orders have accumulated: ')) y=float(raw_input('How many units are in the inventory: ')) z=float(raw_input('How many accumulated orders ...
01110100's user avatar
  • 843
7 votes
7 answers
1k views

Hi everyone I am currently doing a school project and even my teacher is stumped. In Canada the penny has been removed so now all purchases are rounded to either 0 or 5. For example 5.53 would become ...
CF11's user avatar
  • 109
3 votes
1 answer
2k views

I want users to be able to query my database via several different parameters (name, year, etc), dynamically add more fields, and join them with boolean operators; the net result would be something ...
swizzard's user avatar
  • 1,095
1 vote
4 answers
358 views

Can you help me to round like the following? 10 -> 12 21 -> 22 22 -> 22 23 -> 32 34 -> 42 I tried answers from below, but all of them are rounding to next multiplier of a number: Round ...
Paweł Kowalski's user avatar

15 30 50 per page