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