Python City: Understanding how a Python Program Works (The White Room Series #3)

You've written a Python script or a project containing several modules. You press Run, figuratively or literally. What happens behind the scenes in the microseconds or seconds or minutes it takes for your program to run? You can dive into the details about the internal functioning of Python to learn how a Python program works.… Continue reading Python City: Understanding how a Python Program Works (The White Room Series #3)

Bouncing Balls Using Object-Oriented Programming in Python (Bouncing Ball Series #2)

Using Object-Oriented Programming using Python to Simulate Bouncing Balls

In this week's article, I'll discuss an example of using object-oriented programming in Python to create a real-world simulation. I'll build on the code from the first article in the Bouncing Ball Series, in which I looked at the simulation of a single bouncing ball in Python. This article will extend this simulation to many… Continue reading Bouncing Balls Using Object-Oriented Programming in Python (Bouncing Ball Series #2)

How to Create Any Image Using Only Sine Functions | 2D Fourier Transform in Python

2D Fourier transform in Python Earth and grating image

What are the individual units that make up an image? Sure, one answer is pixels, each having a certain value. Another surprising one is sine functions with different parameters. In this article, I'll convince you that any two-dimensional (2D) image can be reconstructed using only sine functions and nothing else. I'll guide you through the… Continue reading How to Create Any Image Using Only Sine Functions | 2D Fourier Transform in Python

Python Instance Variables and Kids on A School Trip

Python instance variables and kids on a school trip

How are Python instance variables different from standard variables? Are they the same thing as data attributes? And what are data attributes? And what do kids on a school trip have got to do with all of this? Questions, questions and more questions. Understanding instance variables in Python tends to happen in stages. First, you… Continue reading Python Instance Variables and Kids on A School Trip

Python List Comprehensions and Michael Phelps’ Olympic Medal Cabinet

Python list comprehensions

Python list comprehensions can look a bit strange at first sight. However, with a bit of practice and experience, they quickly become a go-to tool for a Python programmer. But Python's list comprehensions are not just syntactic sugar that condense three lines of code into one. And they're not there just to make you look… Continue reading Python List Comprehensions and Michael Phelps’ Olympic Medal Cabinet

Stacks and Queues, Deques, and My Daughter’s Teddy Bears

Thanks to my daughter's teddy bears/soft toys/stuffed toys/whatever else you may call them, I now have a better understanding of stacks and queues in Python. I'll get back to stacks and queues in a bit to discuss how to implement them, when to use them, and when not. But first, you'll need to meet my… Continue reading Stacks and Queues, Deques, and My Daughter’s Teddy Bears