How does the likelihood of winning a tennis match change as the likelihood of winning a single point changes? How about the probability of a best-of-five match ending in three sets? Let's have some fun exploring some of these questions using a Python tennis match simulation program. I won't try to factor in all the… Continue reading Part 2: Simulating a Tennis Match Using Object-Oriented Programming in Python—Wimbledon Special
Blog
Simulating a Tennis Match Using Object-Oriented Programming in Python—Wimbledon Special Part 1
With Wimbledon underway, I thought of paying homage to the classic tennis tournament with a program simulating a tennis match in Python. I'll use this program to explore several key concepts in Object-Oriented Programming. You'll write a program which will allow you to do two things: Part 1: You can keep the score of a… Continue reading Simulating a Tennis Match Using Object-Oriented Programming in Python—Wimbledon Special Part 1
Sunrise: A Python Turtle Animation Using Named Tuples
You may think the Python turtle module isn't useful for anything. "It's just for kids", is what many think of it. However, this module allows you to explore and experiment with many areas of Python. In this article, you'll write a Python turtle animation of a sunrise scene using named tuples: https://videopress.com/v/OgwI5VyJ?resizeToParent=true&cover=true&preloadContent=metadata&useAverageColor=true As you work… Continue reading Sunrise: A Python Turtle Animation Using Named Tuples
numpy.meshgrid(): How Does It Work? When Do You Need It? Are There Better Alternatives?
You have come across numpy.meshgrid() already. You may even have used it. But do you know what it does and how it does it? If your answer is "I'm not sure", then you're not alone. Some people find this function hard to understand. Others understand what it does but not why it's needed. And some… Continue reading numpy.meshgrid(): How Does It Work? When Do You Need It? Are There Better Alternatives?
Beware Python Iterators That Are Not Independent
Do You Really Know What Sines and Cosines Are? Visualising Maths Using Python and Turtle
Have your Apollo 11 moment: A Python Lunar Landing game using the turtle module
Debugging Python Code Is Like Detective Work — Let’s Investigate
Debugging Python code is not a mysterious art form. It's like a detective solving a mystery. This analogy comes from one of my favourite programming aphorisms: "Debugging is like being the detective in a crime movie where you are also the murderer" (Felipe Fortes). So what can real detectives tell us about debugging Python code?… Continue reading Debugging Python Code Is Like Detective Work — Let’s Investigate
Understanding Two-Point Perspective Drawing using Python
Have you ever struggled to truly understand a topic? Perhaps one related to your work, or maybe linked to a hobby? Writing a computer program to investigate the subject can often help you get that extra level of understanding you're looking for. I've often used this method to understand fairly abstract physics concepts in my… Continue reading Understanding Two-Point Perspective Drawing using Python
How Do They Build The Starships in Star Trek? Classes and Objects in Python
With so many new Star Trek series coming out at the moment and in the near future, new and old Trekkies are all asking the same question: How do they build the starships in the Star Trek universe? Or maybe it's just me? This article will boldly go on a journey through classes and objects… Continue reading How Do They Build The Starships in Star Trek? Classes and Objects in Python