Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

middle value of a list in python

def findMiddle(input_list):
    middle = float(len(input_list))/2
    if middle % 2 != 0:
        return input_list[int(middle - .5)]
    else:
        return (input_list[int(middle)], input_list[int(middle-1)])
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #middle #list #python
ADD COMMENT
Topic
Name
8+5 =