daily pastebin goal
58%
SHARE
TWEET

Untitled

a guest Sep 19th, 2018 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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]
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top