Python: How do I 'pull' a list through a function
<p>I am trying to find the 'peak' in list of numbers. I tried the following;</p>

<pre><code>list = [5, 12, 34, 25, 13, 33]
n = range(len(list))
def func(n):
    if list[n] &gt;= list[n-1] and list[n] &gt;= list[n+1]:
        print list[n]
print func(n)
</code></pre>

<p>I get back the error 'list indices must be integers, not list'</p>

<p>change 'list' to something else, say 'lst' and by peak if you mean max element then: </p>

<pre><code>lst = [5, 12, 34, 25, 13, 33]
print max(lst)
</code></pre>

python python-2.7