Guest User

Untitled

a guest
Jan 23rd, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.16 KB | None | 0 0
  1. >>> lst = [1, 3, 5]
  2. >>> doubled = []
  3. >>> for num in lst:
  4. >>> doubled.append(num*2)
  5.  
  6. can be simplified to just one line:
  7.  
  8. >>> doubled = [num * 2 for num in lst]
Add Comment
Please, Sign In to add comment