Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

round to nearest multiple of 5 python

def rof(x):   '''round up to multiple of 5'''
    if x%5==4:
        x+=1
    elif x%5==3:
        x+=2
    print(x)
Comment

round to nearest multiple of 5 python from both end

#round up to multiple of 5 from both end
def rof(x,y,z):
    if x%5==4:
        x+=1
    elif x%5==1:
        x-=1
    elif x%5==2:
        x-=2

Comment

PREVIOUS NEXT
Code Example
Python :: numpy array values not updateing 
Python :: python integrated with activeX 
Python :: Are angles of a parallelogram equal? 
Python :: jama python rest api 
Python :: cartpole dqn reward max is 200 
Python :: pycharm writing issue 
Python :: how to use wbtools in python 
Python :: somebody please get rid of my annoying-as-hell sunburn!!! 
Python :: multiclass.roc plot title 
Python :: python program to get equally distributed number from given range 
Python :: python matrix condensed to square 
Python :: How to put a header title per dataframe after concatenate using pandas in python 
Python :: cbv uk django 
Python :: use of numpy matrix in tkinter python 3 
Python :: how to add watermark in mp4 video using python 
Python :: add many instances to related field manytoamny django] 
Python :: fibonacci numbers function python print 
Python :: removing stop words in python 
Python :: add vertical line to horizontal graph 
Python :: how to execute queries with cxoracle python 
Python :: how to call a specific item from a list python 
Python :: how do i add new items to a dictionary within a for loop python 
Python :: how to code discord bot 8ball python 
Python :: store array to nii file 
Python :: "2 + 2" operación en string python 
Python :: pandas log percent change 
Python :: python nltk lookup error Resource omw-1.4 not found. 
Python :: Data Analytics with Pandas – How to Drop a List of Rows from a Pandas Dataframe 
Python :: Palindrome in Python Using reverse function 
Python :: Flatten List in Python Using Without Recursion 
ADD CONTENT
Topic
Content
Source link
Name
6+1 =