Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def reverse(list):
- #@param:
- # list: list;
- # return: list;
- lenght = len(list) -1
- for i in range(0,lenght):
- item1 = list[i]
- item2 = list[lenght-i]
- list[i] = item2
- list[lenght-i] = item1
- return list
- #-------------------------------------------------------------------------------
- def count(list,find):
- #@param:
- # list: list;
- # find: any;
- # return: int;
- count = 0
- for i in list:
- if find == i:
- count = count+1
- return count
- #-------------------------------------------------------------------------------
- def insert(L,n1,n2):
- #@param:
- # L: list of int;
- # n1, n2: int;
- list = []
- for i in range(0,len(L)):
- if L[i] == n1:
- list.append(L[i])
- list.append(n2)
- else:
- list.append(L[i])
- return list
- #-------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement