SHARE
TWEET

Untitled

a guest May 25th, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. colors = ['red', 'green', 'blue', 'orange', 'purple']
  2.  
  3. # simple way
  4. index = 0
  5. for color in colors:
  6.     print(f'{index} ---> {color}')
  7.     index += 1
  8.  
  9. # pythonic way
  10. for index, color in enumerate(colors):
  11.     print(f'{index} ---> {color}')
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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top