What I learned teaching Intro to Python for Girl Develop It

Nadaa Taiyab
6 min readMar 14, 2018

--

A few weeks ago, I taught my very first programming class: a seven-hour Introduction to Python for an organization called Girl Develop It.

This was particularly momentous because I only started coding in Python about a year ago. I recently graduated from the Galvanize Data Science Immersive program, which to say the least, was a pretty intense intro to Python.

I’ve also had to endure too many boring, painful tech presentations. For my seven hour crash course, I was determined to make the class engaging and enjoyable. I wanted to create an experience that would kindle the desire and confidence to learn more.

I received very positive feedback from the class and an invitation to teach a follow-on! I am writing this blog post to share my personal lessons learned on teaching beginners how to code.

Background — The Curriculum

To prepare for the class, I modified an existing set of “Intro to Python” slides created by Caleb Smith. I put them into Jupyter Notebooks with some simple to moderately difficult exercises that I created and/or modified to reinforce each topic. You can find the notebooks in my github repo.

I covered basic data structures (strings, numerics, dictionaries, lists, sets, tuples), control flow (while statements, if statements, comparison operators), methods, and functions. I decided Classes and list comprehensions would be a bit too much to tackle in one day.

To keep things simple, I taught everything from a Jupyter Notebook. This approach let students focus on having fun coding and learning Python instead of also having to learn how to use a text editor and command line interface.

Lessons Learned

1 ) Have a solid plan for how you are going to get people’s environments set up and introduce them to it.

Getting your environment set up is just very confusing and somewhat intimidating for a beginner, even if it seems like it should be so simple.

I asked the participants to download and install the Anaconda distribution before the class, but of course most people did not do that. We spent the first 40 minutes of the class just getting everyone set up with Jupyter Notebook. I even had a TA helping me and it still took a long time! Not an ideal use of precious class time.

This is what I would have done differently:

  1. Create a quick video ahead of time showing people EXACTLY, step-by-step the following: which website to go to, what to click on, how to install it, and how to open the program.
  2. Write the instructions out with screen shots and post those ahead of time.
  3. At the beginning of the class, get everyone’s attention and then go through it live and in person before everyone gets started.

After everyone has their environment up and running, I would do the following:

  1. A quick tour of the technology. In my case, I would show people around Jupyter Notebook, demonstrating its basic functionality and most important shortcuts.
  2. I would even consider adding this tour to the set up video and/or creating written instructions with screen shots as a reference.

This is a lot of work, but there is nothing more frustrating than spending the first hour of class getting set up.

My lesson: invest heavily in creating very clear instructions for students to set up their development environment.

2) More coding exercises, less lecture.

You can’t learn to code from a lecture. Even if you think you’ve understood what the instructor is telling you, actually you have not. My strategy was to get fingers on keyboards as much as possible during the class. I treated the class as more of a workshop than a lecture.

In order to do this, you really have to pair down your content and amp up the exercises. My approach was to teach a small concept, such as concatenating strings, and then get students to practice with a couple of exercises. The first exercise would be really easy — a virtually identical example to the one I had shown. The second exercise would include a new element designed to make them think a bit harder and/or highlight common mistakes. I created a lot of exercises on the spot, too.

The goal was to make them feel like they were being challenged, but also winning! Nothing is more demoralizing than when the exercises in the class are so difficult that you can’t do any of them. Conversely, if they don’t push you to think and make mistakes, then you are not learning.

My lesson: take time to create coding exercises to reinforce each key concept.

3) Create your own exercises

At first I was searching around the web for pre-made coding exercises to use with the class, but then I realized I was better off making them myself. In fact, it’s good practice because it forces you (the teacher) to really think about what concepts you want to reinforce! I even learned a bunch of important things that I had forgotten about or maybe never properly understood myself.

I think the key to creating good exercises is to make concepts build on each other. First start simple, then layer on an extra ‘complication’, add in a concept that you’ve already taught as review, and, finally, throw in something totally new (that may require a stack overflow search) as a real challenge!

If you’re teaching one of these intro courses, you will probably have a wide variety of backgrounds: total newbies to experienced coders looking to learn a new language. This is quite tough to deal with. My solution was to have a variety of exercises with different levels of difficulty so that the advanced students wouldn’t get too bored.

I also think that making the exercises fun and relevant helps. For example, no one really cares about how many prime numbers there are from 0–100. Building a to-do list, meal planner, or wardrobe is a lot more fun and if you do it right, you can still work on the same concepts as you would in a “boring” exercise.

My lesson: create your own exercises, tailor-made to your curriculum and audience. Have a variety of levels of difficulty, build on concepts, and make the exercises themselves fun and relevant.

4) Live coding with audience participation is very engaging. Maybe even live code for the whole class!

To teach students about functions, I did a live coding exercise in which we built a small game, using audience participation to design the game and write the code. People responded really well to this part of the class.

def ask_question(name):
question = "Hello " + name + " do you want to go the swamp, mountain, or beach ?"
user_input = input(question)
return user_input
def give_outcomes(answer):
if answer == 'swamp':
print("You got eaten by a monster!")
elif answer == 'mountain':
print("You met the shaolin master")
elif answer == 'beach':
print("Put on your sunscreen")
else:
print("Error")
def play_game(your_name):
name = your_name
answer = ask_question(name)
give_outcomes(answer)
print("Game Over")

The above very simple program reinforces writing functions, string concatenation, user input, and if statements. It was fun to play it together and most of the class seemed to be “engaged.”

In fact, I think the next time around I would put together Jupyter Notebooks or slides as reference material and then do live coding for most of the teaching, while getting the students to copy what I’m doing on the screen. Of course, doing live coding means you have to be well prepared with a clear plan for exactly what you want to cover!

My lesson: live coding == good.

5) Don’t gloss over any concepts and encourage mistakes.

Be sure to explain EVERY term and not gloss over any concepts too quickly. For example, don’t show an if statement and then assume that how it works is obvious to the audience. Take the time to explain exactly what’s going on at each step. Go slow and check for comprehension. In fact, I think having a white board would have been very helpful for this purpose. I’ve personally seen too many presentations where the presenter just skips over key concepts, because they seem too simple to him or her to bother explaining.

I also very strongly believe that to learn programming or any science, like math, physics, chemistry, etc., you can’t learn without struggle. You have to make mistakes and knock your head against a wall in order to gain a solid grasp of the concepts and how to apply them. So when someone makes a mistake in the class, I celebrate it by saying it’s a “good mistake” because it’s opening up a deeper level of understanding.

My lesson: Explain everything carefully, don’t use jargon, and encourage mistakes as necessary to learning.

Conclusion

Those are my lessons learned from my first experience teaching coding! I hope I will have many more to draw from in the future. I would love to hear about your opinions and experiences. Please feel free to comment below.

If you would like me to teach Python for your group, please get in touch on LinkedIn (www.linkedin.com/in/nadaataiyab) or Twitter (@nadaaita)

--

--

Nadaa Taiyab

Data scientist. Passionate about using data for social good.