Python basics

Many Data Science / Machine Learning interviews contain questions about the most basics design elements / data structures / operations in Python. The resources on this page help prepare for that.

  • The Python Tutorial The official Python tutorial is written in a way that makes it compact and easy to assimilate. There are individual chapters for: - control flows (e.g. if,for, break, pass etc) - data structures (lists, tuples, sets, dictionaries) - modules and packages - input / output - errors and exceptions - classes - virtual environments and a few more topics. I found this guide really useful to read once. Read the basics, just glean over the intricacies, come back to the guide when yo feel like some details were removed from your memory during the regular cleanups.

  • Python FAQ This is a long list of answers to questions about peculiarities we notice in Python. For example: 'Why does Python use indentation for grouping of statements?' or 'Why are there separate tuple and list data types?' I actually had the second question myself. I will not ruin the pleasure of finding out by yourself🥁

  • Python Glossary A list of popular concepts in Python and a short explanation for each of them. For example: decorator

    A function returning another function, usually applied as a function transformation using the @wrapper syntax. Common examples for decorators are classmethod() and staticmethod(). The decorator syntax is merely syntactic sugar, the following two function definitions are semantically equivalent:

    def f(arg):
        ...
    f = staticmethod(f)
    
    @staticmethod
    def f(arg):
        ...
        

    It's a good place to quickly read about things like iterable, iterator, list comprehension or set comprehension, hashtable or the GIL, to give just a few example of popular concepts that are found in this list.

Last updated