Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

round to the nearest 0.5

def custom_round(x, base=0.5):
    return base * round(float(x)/base)

# you can replace the base parameter with the nearest rounding you need 
    
Comment

round up to nearest 10

Math.ceil(N / 10) * 10;
Comment

PREVIOUS NEXT
Code Example
Python :: easy python gui 
Python :: stackoverflow: install old version of networkx 
Python :: retrieve content inside the meta tag python 
Python :: The function to be built, amino_acids, must return a list of a tuple and an integer when given a string of mRNA code. 
Python :: matplotlib force scientific notation and define exponent 
Python :: pygame image get height 
Python :: python word encode asci 
Python :: signup class 
Python :: default dictionary value 
Python :: bst deleting 
Python :: how to use with statement in python 2.5 and earlier 
Python :: create django model field based on another field 
Python :: last element of python list 
Python :: python % meaning 
Python :: programmer tool 
Python :: how to set a hyperlink in python 
Python :: permutation in python 
Python :: sudo in python 
Python :: numpy filter based on value 
Python :: dates and times in python 
Python :: getting last n rows of column 
Python :: python toupls 
Python :: how to divide string in python 
Python :: input a number and print even numbers up to that number in python 
Python :: ide for python 
Python :: selenium options python path 
Python :: pandas print column by index 
Python :: python tkinter importieren 
Python :: python selenium: does not wait until page is loaded after a click() command 
Python :: mountain array leetcode 
ADD CONTENT
Topic
Content
Source link
Name
1+6 =