Let’s Code!

Grow your Python skills with detailed courses and articles that solve real-world problems.

Spotlight

Make your own Tower Defense Game with PyGame

Learn how to make games in Python with PyGame by writing a Tower Defense Game from scratch. You’ll learn sprite handling, movement, kinematics, collision detection, path finding and much more!

Let's Write a Game Boy Emulator

Remember the Game Boy? Have you ever wondered what it would take to build an emulator capable of running Game Boy cartridges? Let's write one and find out!

Illustration of the Game Boy handheld games console

Latest Articles

Tower Defense Game: Game Modes & Collision Detection

Our tower defense game needs a game mode so we know when we’ve won or lost the game, and we want our turrets to fire at passing enemies

Tower Defense Game: Path Finding

Our tower defense game needs a depth-first search path finding algorithm capable generating paths between all possible starts and exists.

Tower Defense Game: Animation and Kinematics

Our tower defense game needs kinematics for motion and rotation, and animation to make it all look nice. The simplest way to do this is with the itertools module, lazy evaluation and generators.

Inspired Tips

Inspirations for busy people

Inspired Python
def current_datetime(dt = datetime.datetime.now()):
    print(dt)

>>> current_datetime()
2021-10-09 16:09:43.009959
>>> current_datetime()
2021-10-09 16:09:43.009959

Python Anti-Patterns: Argument Side Effects


Be extra careful if you assign the result of a function call to a default argument. Python evaluates argument defaults on module load, so if your function is non-deterministic or has side-effects, you could run into trouble. As the example shows, the printed time is frozen; it was set once when the code was first evaluated.

Be Inspired Get Python tips sent to your inbox

We'll tell you about the latest courses and articles.

Absolutely no spam. We promise!