Intro to Python, Preface – The Journey Ahead

This post was originally published here

Data Rebellion presents

Demons and Dwarves, An Intro to Python Adventure

Call to Adventure

A shadow falls over the land. Hero after hero arises to confront the encroaching evil, yet hero after hero is mercilessly slain (or accepts an offer for a pretty sweet management gig). Now, only two things stand between the all-powerful Emperor and his plans of enslaving every sentient lifeform in existence: a dwarven office clerk and the Python programming language. Welcome to the world of Demons and Dwarves.

Demons and Dwarves is an introductory Python programming course in the form of a story that revolves around a puzzle. The first person to solve the puzzle with Python is the winner and, in addition to unlocking the story’s ending and having their name and code memorialized there, gets to choose which charity to have $500 donated to. There are eight chapters in total which will be published one or two at a time over the course of several weeks.

Answers can be submitted as comments in the Prologue. If you get the correct answer, I’ll email you and ask for your code (via the email you have to provide when leaving a comment, which is only visible to me). The first person to reply to me with Python code that correctly works through every part of the puzzle is the winner. If you’re first to leave a comment with the correct answer but don’t provide your code, your code doesn’t check out, or you use a language besides Python, you won’t be declared the winner but you’ll still get an honorable mention.

There are one or more hints in every chapter, some more subtle than others. It is possible to solve the puzzle without any hints, though by the time the eighth chapter is published the hints will have made the puzzle somewhat easier.

Preparing for the Journey Ahead

To get the most out of Demons and Dwarves you will want to not only run the code that occurs in the story as you read through it, but tinker with the code and test creative hypotheses about what might work and why. The more errors the merrier.

To run your code, you’re going to need a code editor. Here are a few options that I suggest:

If you’re brand new to programming, you may also want to read up on the difference between running code in interactive mode versus script mode, as the code in some parts of the story will be easier to run in a particular mode.

Leave a comment if you have any questions.


Table of Contents

    Prologue – The Door
    Chapter 1 – Arithmetic and Variables
    Chapter 2 – Strings and Lists
    Chapter 3 – Conditional Statements
    Chapter 4 – Functions
    Chapter 5 – Loops
    Chapter 6 – Built-in Functions and Methods
    Chapter 7 – Imports and Nesting
    Chapter 8 – Opening the Door

Acknowledgements: Demons and Dwarves was inspired by many other works, but The Wheel of Time series in particular.

Disclaimer: All puzzle-solvers agree that the sole and final judgment concerning all matters related to winner selection, charity donation, and interpretation of rules are at my sole discretion.

Related Posts

Intro to Python, Epilogue – Only the Beginning Congratulations, dear reader, on completing your quest. But be warned, opening the Door was but the first step of your journey. You now have an under...
Intro to Python, Chapter 8 – Opening the Door Baldric was suddenly standing in a crowd of soldiers. Not Imperial soldiers thankfully. These were more ragtag, wearing random bits of armor here and...
Intro to Python, Chapter 7 – Imports and Nesting Baldric had been a town guard for years, breaking up fights and catching thieves and helping the elderly cross the street. When the Empire arose and ...
Intro to Python, Chapter 6 – Built-in Functions and Methods Magic-wielding escapees were desperately deflecting the Imperial attacks on the fortress’ supports as best they could. Ranks of longbowmen rain...

Leave a Reply

Be the First to Comment!

Notify of