Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class IntList(list):
- def append(self,elem):
- if type(elem) is int:
- super().append(elem)
- pass
- def positive_sum(self):
- S=0
- for i in(self):
- if i>0:
- S+=i
- return S
- def negative_sum(self):
- S = 0
- for i in (self):
- if i < 0:
- S += i
- return S
- def insert(self,ind,elem):
- if type(elem) is int:
- super()[ind]=elem
- pass
- def extend(self,elem):
- if type(elem) is int:
- super().append(elem)
- pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement