Chapter 2: The Time travelling cow

Start Here

Chapter 1: In which a cow surprises you 

Chapter 2: The Time traveling cow

Chapter 3: Greedy banker strings

Chapter 4: More on strings and donkeys

Chapter 5: Crooks R Us Bank & Lists

Chapter 6: Orc functions

Chapter 7: Dictionaries, Locks, and Gobbledygook

Chapter 8: Python vs the Zombies

Chapter 9: The Doggy-Nator and List Comprehensions

Chapter 10: In which you Eval the Doggy


The Moo-Inator from the Future

“Who are you?” you ask.

“I am the Moo-Inator. I come from the future.”

“And what happens in the future?” you ask.

“Terrible things. Horrible things. The prices of onions will go through the roof. Kids will no longer respect their parents. And oh yeah. Evil zombie bankers will destroy civilization.”

“Oh my SpongeBob Squarepants!” you shout (as you are an agnostic). “Children will no longer respect their parents? Those little rascals. Next time I see those damn kids, I will tell them to get off my lawn.” You scratch your butt. “What was that about zombie bankers?”

“This year, the Crooks R Us Bank will create a Golden Computer. It will be the One. The Golden Laptop will be able to rule all other computers, and bring the world to an end. Also, something about zombies. Anyway, there is a message on the Golden Laptop, written in a language so foul, I won’t repeat it here. It says:

“One laptop to rule them all,
One laptop to bring them together,
and with the power of COBOL,
bind them.
One Laptop to Rule them All.”


Comments in Python

The simplest way to comment code is to use a #

Python also allows multi line comments. This is done by using 3 single quotes ”’Put long comment in here ”’.

Warning: WordPress is converting the single quotes to smart quotes. Try to ignore that.


“Okay,” you say. “Thanks for the info dump. But why are you telling me all this?”

“That’s simple. Because you are a wizard, Harry. And you have the power to…”

“Wait, wait. My name isn’t Harry. It’s Dr Underpants.”

“What? Let me talk to my agent.”

Moo-Inator took out his phone and starts talking. After a few minutes, he returns.

“It seems I am in the wrong story. But my agent tells me this is the only story that will pay me, so I am stuck here. Underpants, I have a shocking secret for you.”

“What? I left my cooker on at home, didn’t I?”

Moo-inator gives you a weird look. “Ummm, no. The secret is: Underpants, you a geek.”

“Wait, what? No, that can’t be.”

“Yes, it is. Not only that, you are the Chosen One Geek. You must defeat the Evil Lord, He Who Can Be Named, But Whose Name We Have Forgotten.”

“What’s his name?” you ask.

“Don’t know. I’ve forgotten. It was Shantnu or something.”

“So how can I defeat him?”

“Using the power of Python, of course.”


Side note totally unrelated to either the story or the tutorial, but which relates to the word ‘Power of’

I often use Python as a replacement for calculator. The reasons being that Python is more powerful, has more libraries, and I can copy paste my calculations. Since we were talking about the power of Python, let’s see the power of function:

Can also be done in this way:

If you bring in the math library, you can do more:


And if you bring in more powerful libraries, you can do signal processing algorithms, like the Fast Fourier Transform. Note: This exampe uses Numpy, which has to be installed separately:

Try to do this in Windows calculator, and your PC will explode.

End of unrelated sidenote


“But I don’t know Python,” you say.

“That’s fine. Since you are the Chosen One, you can learn any skill and master it faster than people who have been it doing it for years. Tell me, Underpants. Do you have a cloud shaped scar on your posterior?”

“Yes,” you say. “I was drunk, and fell.”

“No!” Cow-Inators vehemence shocks you. “That scar was given to you by the dark lord. He also killed you parents, and you must avenge them!”

“My parents are still alive. They run a bakery in Aberdeen.”

“He killed your parents, and you must avenge them!”

You decide not to argue with him, as its clear the cow is crazy.

The Cow-Inator puts on his cool sun glasses. “Anyway, you need to come with me, if you want to live. Also, I have a buy one get one free voucher for Cheap Burgers, and we can really go wild. I’ll even buy us Freedom Fries.”

Leave a Reply

Your email address will not be published. Required fields are marked *