Telling a Story through Code: A Tale of Two Hamsters

Posted: July 26, 2011 in My Data Journey
Tags: ,

This is Cuddles. He’s a Russian Dwarf hamster. We have 2 males. Cuddles is the beta male. He was fat and lazy which made him very docile. You’d like Cuddles. He’s a good little hamster. He’s been made docile by the fact that he’s bullied by the alpha male.

We initially called the alpha male ‘Dimples’ but he turned out to be really evil. So we renamed him Morbo. This is after the news presenter from Futurama: Morbo the Annihilator. Because Morbo incessantly bullies Cuddles, he’s broken out in boils and is under weight. Whenever we give him food, Morbo steals it from him. Morbo often pushes him over and presses him until he squeaks. In fact, we’re going to separate them even though Russian Dwarf hamsters are supposed to be social creatures.

To mark this point of separation I have written a piece of code to explain why it is necessary for poor Cuddles to be taken away from his brother. It’s also a exercise for me to learn about classes in Python but nevertheless it is very poignant. Here it is:

It’s on ScraperWiki so you can play around with the parmeters. It takes an initial hamster weight of 300g and assumes he loses 2g every time he’s chased by Morbo and gains 5g every time he eats. Morbo bullies him up to 10 time a day. It shows you how long he has to live. You can change these parameters to see how that changes his life expectancy.

Here’s a part of the output from my command line:

I’m a journalist learning to code and this is my story telling through the medium of Python.

This will explain a part of the code:

Comments

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s