Is your coding interview coming closer? Or do you want to learn Python but you don’t know where to start (and on which topics to focus)?
In this article, I will answer this question for you assuming that you are talking about core Python knowledge. Of course, there are dozens of different specializations within Python—but that comes later. First, you need to build your basic understanding of the following Python topics.
1. Python Keywords
Any programming language has a fixed set of defined words with special meanings. They are called keywords. And you must know them by heart!
Here are all Python keywords:
import keyword print(keyword.kwlist) ''' ['False', 'None', 'True', 'and', 'as', 'assert', 'async', 'await', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'nonlocal', 'not', 'or', 'pass', 'raise', 'return', 'try', 'while', 'with', 'yield'] '''
In the following cheat sheet, I’ve explained the meaning of all Python keywords with examples.
If you want to download this cheat sheet as a high-resolution PDF to print it and pin it to your office wall, click the image or this link.
2. Python Basic Data Structures: Boolean, Integer, Float, String
Here are the Python basics EVERY Python coder must master:
Again, to download this cheat sheet as a high-resolution PDF, click the image or this link.
3. Complex Data Structures: List, Set, Dictionary
Those data structures lie the foundation of your Python expertise. If you’d build your own house, you wouldn’t be cheap with the foundation, would you?
Well, learning Python may be an activity with much more impact on your life than building your own house. So don’t miss out on studying this carefully. I’ve created a cheat sheet that helps you with that:
I’m not kidding—this is one of the most important pieces of paper you’ll ever study. Download this sheet as a PDF and save it to your computer. Simply click the image or this link to save your own version.
Slicing is a Python-specific concept for carving out a range of values from sequence types such as lists or strings…
I’ve written a full booklet that teaches you how to become a master slicer:
You can get the book for free when purchasing my first book “Coffee Break Python”.
5. Python Functions and Tricks
Python is full of useful functions or tricks. On this article, I’ve compiled the 18 best Python tricks in existence! Check them out, it’s a lot of fun…
Here’s one such trick:
import this # OUTPUT: ''' The Zen of Python, by Tim Peters Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex. Complex is better than complicated. Flat is better than nested. Sparse is better than dense. Readability counts. Special cases aren't special enough to break the rules. Although practicality beats purity. Errors should never pass silently. Unless explicitly silenced. In the face of ambiguity, refuse the temptation to guess. There should be one-- and preferably only one --obvious way to do it. Although that way may not be obvious at first unless you're Dutch. Now is better than never. Although never is often better than *right* now. If the implementation is hard to explain, it's a bad idea. If the implementation is easy to explain, it may be a good idea. Namespaces are one honking great idea -- let's do more of those! '''
By calling the statement
import this, Python teaches you how to write Pythonic code. How meta!
Here’s a full cheat sheet with many different Python tricks:
All cheat sheets are available for download. Simply click on any cheat sheet image to register for my Python email list for continuous improvement. All list subscribers will be able to download the cheat sheets.
While working as a researcher in distributed systems, Dr. Christian Mayer found his love for teaching computer science students.
To help students reach higher levels of Python success, he founded the programming education website Finxter.com. He’s author of the popular programming book Python One-Liners (NoStarch 2020), coauthor of the Coffee Break Python series of self-published books, computer science enthusiast, freelancer, and owner of one of the top 10 largest Python blogs worldwide.
His passions are writing, reading, and coding. But his greatest passion is to serve aspiring coders through Finxter and help them to boost their skills. You can join his free email academy here.