why in method 2, i use dictionary is accepted, by in method 3, list gives run time error?

```
class Solution:
# @param {integer[]} nums
# @return {boolean}
def containsDuplicate(self, nums):
#method 1
#return len(set(nums))!=len(nums)
# method 2
dic={}
for i in nums:
if i in dic:
return True
dic[i]=1
return False
#method 3
listt=[]
for i in nums:
if i in listt:
return True
listt.append(i)
return False
```