Every Concept Counts: Creating appropriately leveled Python projects

Renee Noble
Grok Learning
Published in
7 min readOct 25, 2019

Python is a very readable language! As a proficient programmer this is great for being able to pick up the gist of a line of code quickly. But this can mean that we don’t see all the Python concepts we jam into one line of code that will overload learners.

Using some example projects taken from the Girls’ Programming Network, we’ll take a look at just how many Python concepts we’re using to create a basic program, and we’ll see how we can design projects to fit different levels of experience.

Caesar Ciphers

First let’s take a look at a Caesar Cipher project. The program asks the user if they are encrypting or decrypting a message, and asks for a message and an encryption key that will be used for the rotation. Finally it outputs the encrypted message.

Output from the Caesar Cipher program

We’re able to make the following simple rotation cipher in only 15 actual lines of code, using only concepts that would be accessible to newer programmers.

Final code for a Caesar Cipher Project, courtesy of the Girls’ Programming Network

However, while the final code might be short, it’s the number of concepts that really counts. Here we have 16 concepts spread over 15 lines. As we can see from the picture above, nearly every line requires a new concept, sometimes two. There is also little chance for repetition to practice concepts already learnt.

So, although most concepts on their own are ones a beginner programmer could be expected to learn in isolation, the combined complexity of this code is high — especially considering the cognitive load of understanding the underlying computer science algorithm required to encrypt each letter.

All this doesn’t necessarily make this project inaccessible for a beginner programmer. It just means more classroom time and practice examples might be needed to learn and practice the concepts before using them in the project.

Meanwhile, it makes an excellent project for an intermediate student. If students already have a solid understanding or fundamental programming concepts such as variables, basic arithmetic, input and have some familiarity with if statements and loops, the number of new concepts in this project starts to drop quickly.

Unplugged cipher encryption games using cipher wheels are ideal for teaching the computer science concepts of this project.

Using concepts they have already mastered in a new context will still require a little cognitive load, and concepts they have some familiarity with will still have a significant but reduced load. But overall the complexity of the project quickly falls, allowing them to better take up new, interesting concepts such as modulo arithmetic and encryption algorithms, which speak more to the power of computer science with less focus on using basic programming tools.

Scissors Paper Rock

Next we’ll take a look a creating a Scissors Paper Rock project where a human will play against a computer.

Output from the Scissors Paper Rock program

Compared to the Caesar Cipher it take a lot more lines of code to create this project, with a total of 27 actual lines of code. This may seem like a major drawback for little hands that type slowly. But looking at the diagram below, we can see there are fewer Python concepts: only 13 over those 27 lines.

Final code for a Scissors Paper Rock Project, courtesy of the Girls’ Programming Network

While the code is twice as long, we actually have two fewer concepts to learn. This signifies that there’s a lot of concept repetition throughout the project, providing ample opportunities to practice the concepts. The project even has some unnecessary repetition built in; for instance, asking for the player’s name at the start of the game and printing a welcome to them. While not essential to the game mechanic at all, it gives students an in-project opportunity to practice the skills required for the more complex game aspect.

Getting students to write out a table of the different game combinations will help them see how they can transform the logic of one win condition if statement to other game outcome combinations.

While this code still requires sometimes two, or even (as with the if statement) three new concepts on a line, the number of repetitions means we can assist learners more in the course of the project without giving away the whole solution. For example, providing the logic for the first if statement gives students an example of this somewhat complex logical combination, which they can edit to figure out the rest of the combinations for winning the game. This gives learners the chance to properly understand and manipulate interesting logic and control structures, and focus on core skills we want beginners to become comfortable with.

Having these repetitions built into the project itself means reduced classroom time spent on learning and practicing concepts outside of the project. This has a variety of benefits, like keeping students more engaged with project driven work, or allowing more advanced students to improve on their core project idea while other students catch up.

In addition to the reduced number of concept, using the concept of playing Scissors Paper Rock also requires less overhead than a Caesar Cipher because the Scissors Paper Rock algorithm/set of rules is something students are already familiar with. This familiarity will give them a better understanding of their own code, and an understanding of the progression of building new features such as asking for input from the user, deciding the computer’s move and calculating the winner. Having a better understanding of the final product will give students more foresight and ability to debug their project when things don’t go as expected and more scope to customise their core project to creative variations.

Comparing Concepts

In comparing these two projects we saw the benefits of increased code length for providing more opportunities for practice. However moving from the exciting sounding Caesar Cipher to a more basic sounding Scissors Paper Rock project only cut out three concepts. So is the required total concept cognitive load actually significantly lower?

While the number of concepts is similar, so far we have yet to consider the difference in difficulty of learning different concepts. The following picture shows how we would break down the concepts into categories: small, medium, big and extra big concepts. Each category reflects the cognitive load required for a beginner programmer the concepts.

Comparing these two projects at a beginners level we see the Caesar Cipher project has a more widespread distribution of concepts, peaking in the mid-range difficulties. The Scissors Paper Rock project, on the other hand, centers around small to medium concepts, with a few challenging concepts to focus on mastering. Adding in the additional difficulty of learning the Caesar Cipher algorithm, we can see how new programmers find the Scissors Paper Rock project significantly more accessible.

There are many things that affect the time students take to pick up new concepts, and it’s easy to forget how hard they are to pick up once you’ve come to understand them. For instance the abstract nature of variables makes them hard to understand at first, but once you understand them it’s impossible to imagine a world in which you don’t understand them.

For loops have a lot more going on that we give them credit for!

Other concepts require a deep understand of Python syntax to comprehend the concept in full and to be able to use that same idea in a new context. For instance the for loop requires an understanding of how the computer updates variables, loops through strings and the control structure over the body of the loop. Learners need to be able to replicate all these functions within a new context to apply this concept. Similarly the “and” logical operator seems like a simple idea, but to be able to use it effectively you need to understand properly the boolean logic of anything you may be joining.

On the other side, some concepts are a lot easier to pick up than the code may indicate. For instance randomly choosing something from a list requires a long line of code, however repurposing an example in a new context is intuitive for learners. Similarly creating a game loop with “while True:” is something that students can just copy and understand.

As learners become more experienced, you start to get some of the easy concepts “for free” in terms of cognitive load, putting the Caesar Cipher project in reach for slightly more experienced learners.

I hope you’ve enjoyed this concept based approach to project planning. Of course, any path to mastery is full of practice in a variety of contexts! To make your own version of one of the projects above try out our Python Playground to code anything you like. Or to work on mastering some of those concepts to put into projects, give our Introduction to Programming course a go!

If you’re interested in learning more about my approach to counting concepts, check out Scissors-Paper-Rock your classroom with differentiated projects to learn more!

--

--

Renee Noble
Grok Learning

Technology | Education | Community = Regional Cloud Advocate @ Microsoft; CEO and Founder ConnectEd Code; National Director @ Girls' Programming Network.