Geeky Gadgets: 11 Tech Gadgets for the Last Names on Your Holiday Shopping List The holiday shopping season is here, and it’s time to discover the best presents for every name on your list. Whether you’re buying for adults or children, tech gadgets are popular year after year for ... 11 Tech Gadgets for the Last Names on Your Holiday Shopping List Most gadgets don’t live up to the promise.

Understanding the Context

These did. After months or years of use, these are the 10 gadgets I would buy again without hesitation. Each one proved useful, reliable, and worth the money ... When reading, list is a reference to the original list, and list[:] shallow-copies the list.

Key Insights

When assigning, list (re)binds the name and list[:] slice-assigns, replacing what was previously in the list. Also, don't use list as a name since it shadows the built-in. The first, [:], is creating a slice (normally often used for getting just part of a list), which happens to contain the entire list, and thus is effectively a copy of the list. The second, list(), is using the actual list type constructor to create a new list which has contents equal to the first list. I have a piece of code here that is supposed to return the least common element in a list of elements, ordered by commonality: def getSingle(arr): from collections import Counter c = Counte...

Final Thoughts

Is there a way in Python to list all installed packages and their versions? I know I can go inside python/Lib/site-packages and see what files and directories exist, but I find this very awkward. ...