I am trying a simple piece of code and I couldn't get it work to find the middle point in list. Can someone guide me with logic, please. I am a newbie and I tried a few examples on StackOverflow already but it didn't work for me.

Here is the code:

```
lst = [1, 2, 3, 4]
midpoint= len(lst)/2
for val in lst[:midpoint]:
     print(val)

```

Error is:

```
TypeError                                 Traceback (most recent call last)
<ipython-input-67-452ff692c8fd> in <module>
----> 1 comp(lst)

<ipython-input-66-a6223c2e7902> in comp(lst)
      3 
      4     midpoint= len(lst)/2
----> 5     for val in lst[:midpoint]:
      6         print (val)

TypeError: slice indices must be integers or None or have an __index__ method

​

```