1def second_largest(numbers):
2 if (len(numbers)<2):
3 return
4 if ((len(numbers)==2) and (numbers[0] == numbers[1]) ):
5 return
6 dup_items = set()
7 uniq_items = []
8 for x in numbers:
9 if x not in dup_items:
10 uniq_items.append(x)
11 dup_items.add(x)
12 uniq_items.sort()
13 return uniq_items[-2]
14print(second_largest([1,2,3,4,4]))
15print(second_largest([1, 1, 1, 0, 0, 0, 2, -2, -2]))
16print(second_largest([2,2]))
17print(second_largest([1]))
18
19