Week 2 of Code in Place

Week 2 started with an AI-based Feedback on my Section. Which was super interesting. I see why they used AI to provide some time of feedback to Section Leaders since there are about 700 section leaders. It looks like our Sections are recorded, then the audio is transcripted. Then the transcription is analyzed looking for keywords like:

  • What do we want to do?

  • How do you feel about that?

  • How did you figure that out?

  • Can you explain how you solved this?

  • Why did you approach ____ in __ way?

  • What information do you know?

  • What are you trying to figure out?

  • What have you tried so far? What happened?

For being the first Section and my first time, I’m pretty proud of getting 12 strangers together to work through a technical problem in 1 hr. 

This week was a bit of a review of the concepts introduced last week, but instead of framing them in the terms of Karel (Karel is a web based program of a little robot that helps folks learn to code), Python was introduced! The concepts were reframed using Python examples, so instead of just using the front_is_clear() function, students were introduced with the concepts of functions and data structures. 

If you want to check it out at: bit.ly/cip-week2. It goes over our check in, a light review of the week’s key concepts and then we jump into coding!

This week’s key concepts were:

  • Decomposition Tips

  • Variables & Data Types

  • Control Flow

Decomposition Tips

We went over some Decomposition tips and how thinking about how breaking the problem down into smaller problems makes it easier. 

Then I shared how this is an important skill to learn. And demonstrated how important it was by showing them what Harely Ferguson posted on Tuesday about taking the time to think and plan is a super important skill for developers. 

Variables & Data Types

Then we reviewed variable naming conventions, specifically for python. Then we went over the different data types. Instead of using examples that were like x = 10 or y = “hello world”, I went with better variable names to stress the importance of building that skill.

There was an article that popped into my feed all about the difficulty of naming. I shared with the group Samuel Braun’s article called Naming: Every Developer’s Nightmare

Control Flow

Then we did a review of Control Flow – this came in handy later when we were solving the problem because had to do with using an if/else inside of a while loop.

Section Coding Project

Then we jumped into solving a problem using Karel. This week was all about figuring out pre and post conditions of the problems. Karel always starts on the left hand side facing East. The space to the right of Karel’s starting position always has a pile of beepers. Karel needs to spread the beepers out from the pile to the right side with the number of beepers in the pile. The tricky part is that we couldn’t use a counter. So it was about using while loops. 

I had the group spend 5 mins on their own trying to figure out how to solve this. I used the whiteboard functionality in zoom to help students visualize and problem solve. They were able to provide different ways that they could solve it. 

Some students implemented their solution but didn’t consider all the use cases, so we had students share their code and we walked through it and resolved their issues. 

Then we started working through one of the ways to solve this. As we did we got into a tricky space of having a while loop but wanting an alternative method within it.

So one student suggested something (which they had implemented on their project) but wasn’t able to explained why it worked. So I asked them to share their screen and to my surprise, recursion! 

We chatted a bit about what was happening, and how they were using recursion like a while loop.

So we solve that issue and brought back the idea of checking if there a beeper after we pick up the beeper: 

def main():
    """
    You should write your code to make Karel do its task in
    this function. Make sure to delete the 'pass' line before
    starting to write your own code. You should also delete this
    comment and replace it with a better, more descriptive one.
    """
    move()
    while beepers_present():
        pick_beeper()
        if beepers_present():
            while beepers_present():
                move()
            put_beeper()
            reset_karel()
            move()
        else:
            put_beeper()
            reset_karel()
            
def reset_karel():
    turn_around()
    go_back()
    turn_around()

   
def go_back():
    while front_is_clear():
        move()

def turn_around():
    turn_left()
    turn_left()

Check out a visualizer of what the code below does: https://codeinplace.stanford.edu/cip3/share/IQk9AzzkVWrAx6EwDehe 

Thoughts

I was so not expecting to see recursion in this class, that was a surprise. This problem was tricky to walk through with beginner folks. I did have two “new” students who didn’t attend last week’s section, which was great to see. As of Thursday, I still have the 12 students that I had last week. 

I also forgot to take a group photo!

Previous
Previous

Week 3 of Code in Place

Next
Next

Code in Place Week 1