title: How to find the middle element/index of a list in Python?
body: <p>I want to be able to print the middle element of a list . The list might be just strings, integers or mixed.  I tried this, by finding the index of the middle element, but doesn't work. (It prints 2) </p>
  
  <pre class="lang-py prettyprint-override"><code>list = [1,3,7,"this",3,"that",7]
  
  if int(len(list))&lt;2:
    middle = 1  // if it has less than 2 entries, the first entry is the middle one. 
  
  elif int(len(list)) %2 == 0 :
    middle = int(len(list)/2)
  
  else: 
    middle = int((len(list)/2) - 1)
  
  print(list[middle])
  </code></pre>