Reputation: 10040
I would like to make a function:
def accuracy(number, index):
For example
accuracy(2.5e-10, -5)
would return 0.
accuracy(49, 2)
would return 0.
accuracy(50, 2)
would return 100.
So basically it would round to the closest 10 power of the index index
How would you do that?
Upvotes: 2
Views: 654