Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- list_ = [2,4,4,3,7,10,9]
- i = 0
- while i <= len(list_) - 1:
- if list_[i] % 2 == 0:
- try:
- if list_[i + 1] != list_[i]:
- list_.insert(i, list_[i])
- i += 2
- except IndexError:
- break
- else:
- i += 1
Advertisement
Add Comment
Please, Sign In to add comment