here2share

# weighted_list.py

Mar 18th, 2019
284
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.13 KB | None | 0 0
  1. # weighted_list.py
  2.  
  3. items = { "a": 10, "b": 5, "c": 1 }
  4. result = [k for k in items for dummy in range(items[k])]
  5. print result
Add Comment
Please, Sign In to add comment