Guest User

Untitled

a guest
Nov 29th, 2015
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.27 KB | None | 0 0
  1. list_ = [2,4,4,3,7,10,9]
  2. i = 0
  3. while i <= len(list_) - 1:
  4.     if list_[i] % 2 == 0:
  5.         try:
  6.             if list_[i + 1] != list_[i]:
  7.                 list_.insert(i, list_[i])
  8.             i += 2
  9.         except IndexError:
  10.             break
  11.     else:
  12.         i += 1
Advertisement
Add Comment
Please, Sign In to add comment