Guest User

Untitled

a guest
Sep 19th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.14 KB | None | 0 0
  1. nums = [1,1,0,1,1]
  2. oFlag = 1
  3. res = []
  4. for x in nums:
  5. if x == 0:
  6. oFlag = 0
  7. res.append(oFlag)
  8. print(res)
  9.  
  10. # Output: [1,1,0,0,0]
Add Comment
Please, Sign In to add comment