Suppose you've seen our promotional video for our Welcome to Python course. You may have wondered why it features an eccentric pizzeria owner, Mario, who wants to change the world by convincing everyone that anchovies are the best topping to add to a pizza.

Do you need a story about pizzas to learn Python? I believe that you do. Not only do people love stories, but they are also wired for them. At least, Oliver Sacks thinks so. In his book, The Man Who Mistook His Wife for a Hat, he states, "A man needs such a narrative, a continuous inner narrative, to maintain his identity, his self."

Without the continuous narrative, we tell ourselves, we have no idea who we are. Is this why narrative is so powerful in helping your brain make connections? I want to explore this idea, but first, let's do a logic puzzle.

## A Puzzling Perspective

Imagine that the image above is four cards. Each card has a number on one side and a letter on the other. The visible faces on the cards are 3 and 8, A and B. If I tell you that all the cards with even numbers will have a consonant on the opposite side, which cards would you need to flip over to test this statement?

Spoiler Alert – Here is the solution:

The correct response is to flip over the 8 card and the B card. The rule says nothing about odd numbers, so if the 3 card has a consonant on the other side, it won't violate the rule. Likewise, if you flip the A card, it won't matter either because there is no rule about consonants limited to even or odd numbers.

Did you get the correct answer? Did you know that only 10% of people get this one right?

## Perspective is Everything

Let's try the puzzle another way. Imagine you are in a bar tasked with ensuring only people over 21 have alcoholic beverages.

The cards now represent the information you have about a group of people sitting at a table with their beverages. However, each card only has information about the customer's age or beverage. So which cards do you need to flip to ensure that if a customer drinks a beer, they are over 21?

The entire problem looks different now. I don't need to know your age if you are drinking a soda. If you are over 21, there is no need to make sure you don't have a beer. Does it surprise you that people presented with the puzzle in this context performed much better? Given the task of monitoring the alcohol consumption of minors, about 75% of people get it right. What changed?

This puzzle bases itself on the Wason Selection Task. People who initially have difficulty solving the puzzle can solve it correctly when seeing it in a different context. Researchers have lots of theories about why this is. Many focus on "cheat detection" and our tendency to enforce social rules. What is excellent about this experiment is that you can make people more successful, not by changing the task itself, but by changing how you frame it.

When applied to learning, the most interesting part of the experiment isn't that we gave the puzzle some social rules about drinking. What matters is that you can increase people's likelihood of success by wrapping a story around the problem. People can make more sense from a teenager drinking a soda than from random letters and numbers. We learn better when there is context and narrative.

Here is my version of the Wason puzzle according to the world of Mario.

a = 33
b = 200
#check b is less than a
if b < a:
print("b is less than a")

In Python, the text above is a basic "if statement" in Python. Let's make it a little more relatable by giving it a narrative and some context.

Mario is introducing a lunch buffet at his pizzeria. He wants to offer the buffet for free to children under the age of 12. You need to write a statement in Python that checks a customer's age against the age limit for a free buffet.

The age limit is 12 to eat at the buffet for free. So, you set the variable "limit" to 12. Now, you can use the "if" statement to check the customer's age against the limit for the free buffet. For example, if the customer's age is 10, create a print statement for the buffet discount.

limit = 12
age = 10
#check if the customer age is less than the limit
if age < limit:
print("The buffet is free.")

## Pizza and Python

The point of blending pizza and Python isn't to promote anchovies as a pizza topping. Though I must add, anchovies are the most underrated of toppings. Instead, the intention is to use a story to introduce concepts that non-programmers may initially find hard to grasp without a narrative.

The human brain is a storyteller. Putting learning in context makes connections more accessible and helps make the whole process more engaging. Award Solutions strives to make technical concepts easier to understand and, ideally, a little more fun.

You can learn more about the Wason test and its interpretations at Making Sense of Wason, Psychology Today:.