SHARE
TWEET

Untitled

a guest Jul 11th, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. """
  2. Solution #1: Create a shallow copy of dict
  3. """
  4. coffees = get_menu()  # I use this function to generate my dict object
  5.  
  6. coffee_copy = {**coffees}   # Create a shallow copy
  7. for code, details in coffee_copy.items():
  8.     if details.get("sugar_free") is True:
  9.         del coffees[code]
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