Week 6
Variables, Expressions, and Statements

Weekly Summary

For the remainder of the semester we will be programming in the text-based, Python programming language.

www.python.org

This week we will look at the building block operators in Python that allow us to perform basic mathematical operations and store results in appropriate variables.

Recall from our prior Scratch Unit that we defined variables as:

Learning Outcomes

By the end of the week students should be able to:

  • Given the name for a variable, indicate whether it is a legal name in python (does it follow the rules of syntax).
  • Given one or more mathematical expressions using the python mathematical operators, indicate the result.
  • Describe the function of the three Python division operators.
  • Explain differences between integer and floating-point data.
  • Given one or more statements that set the value of a variable, indicate the data type of the variable.
  • Given one or more statements, indicate the value(s) in one or more variables upon completion of the statements.
  • Given a print statement, determine the output.

 

Learning Materials

Explaining this section

Each week I will ask you to complete several learning activities. These will typically consist of a combination of lesson videos, textbook readings, and hands on lesson activities. The order in which these are presented will vary from week to week. In most cases I strongly encourage you to complete them in the order presented in this section. But if you have some experience with this topic you may elect to shuffle them around and even skip certain sections. Just remember - you are responsible for this material and how it connects with the previously listed Learning Outcomes.

 

If you didn't attend the CoP on Saturday...

PRIOR to starting this week's materials you should make sure that you have done some activities that were completed at the Community of Practice event on Saturday, September 28. You should look carefully at all of these activities. But, you will most definitely wand/need to complete :

 

Our Lessons - Getting Started with Python

  • LESSON - Python is an interpreted language
  • LESSON - Using several Python IDEs
    • This video is from a year ago and one of the slides mentions a tool called Repl.it
    • The Education component of this tool is gone so we no longer use it in this class.
    • I edited out the discussion about the software, but you will see it on a slide.
      • No worries. We aren't using it.

 

POGIL Activity #2

If we were working in a face-to-face classroom I would have you complete the following POGIL activity in groups of 3 or 4 [which is the intention of POGIL activities]. Since we are not face-to-face I give you the option of either:

  • completing this face-to-face with a small group of peers (do you have classmates in the same building or school district?)
  • completing this online with a small group of peers (reach out to some classmates from your CoP sessions)
  • completing this on your own

The choice is yours and you don't have to tell me (because I'm not collecting this activity. It's for learning purposes, not grading purposes).

 

In my classroom, we would have several opportunities to talk about what you were doing in the POGIL. Online, that gets lost. Fortunately, most of this POGIL is well explained either in the readings below OR in the podcast videos that come after that.

 

Textbook Readings

 

Additional Explanations (Podcasts)

These videos add to the previous formal lessons. They are here as extra explanation on certain topics. Most cover things that aren't standards BUT will help make the learning process easier in the long run.

Practice Materials

Explaining this section

Each week, I will provide you with various activities to practice what you’ve learned in the "Learning Materials" section. These activities typically include Parsons Problems, Debugging Problems, (Paired) Programming Practice, and links to additional resources from your textbook. I strongly encourage you to complete these activities in the order presented.

At the end of this section, you’ll find “Code Walkthroughs” — either videos or code that explain the prior problems. You can use these materials as you work through the tasks to help resolve any lingering issues before moving on to the next section.

Please note that the materials in this section are not graded. While I can see your progress on the textbook materials and (Paired) Programming Practice, this information is not considered when assigning grades.

 

Parsons Problems

You have encountered Parsons Problems in your textbook, such as Activity 2.10.6 on Runestone Academy. These problems present the complete code for a program, but in a mixed-up order, sometimes including extra, distracting code. Your task is to arrange the pieces correctly to "write" the described program. These problems are a great first step in learning because they allow you to focus on the semantics of programming rather than the syntax.

This week, we will use some Parsons Problems that come as part of your textbook.

 

  • Go to : 2.16. Mixed-up Code Questions
  • Before you start, make sure that the drop down box at the top of each problem is set for Parsons Problems like:
  • I suggest you complete
    • problems 3, 4, 5, and 7.
  • You may absolutely practice with the other ones as well, although I think some of those are a little strange or difficulty at this point in the course.

 

"Solutions" for these four examples are included in the Code Walkthrough section below.

 

Debugging Problems

Fixing programs that are "almost" correct but not yet functional is a crucial skill. As teachers, we often assume students will develop this skill by debugging their own work. However, it can be beneficial to provide explicit practice in debugging.

We do not yet know quite enough material to have a debugging activity this week. We will start these next week.

 

(Paired) Practice Programs

Each week, I will provide you with several practice programs (non-graded) that I encourage you to attempt before tackling the graded assignments. Solving these practice programs first offers two key advantages.

  1. I strongly encourage you to work with a partner on these programs - an activity called "paired programming." To complete these activities the two of you will get together face-to-face or using an online video tool such as Zoom, Microsoft Teams, or Google Meet. Then, you work together to solve the problems. There are several advantages of working with a partner at this stage:

    • Two heads are better than one. As you are first learning, it is easy to forget one small detail that renders your program incorrect. Often times, two sets of eyes are helpful in locating the problem.
    • There are different paths that get to the same goal. Even if you have the knowledge to solve a problem one way, it is beneficial to understand alternate solutions. A pair of partners working together often can discuss the trade-offs of different solutions and, in the end, understand the content much better.


    You are not required to work with a partner. But I strongly encourage you to give it a try and see that it is beneficial.


  2. I will provide you with my solutions. This allows you to not only get help on a problem that is still giving you trouble, but it allows you to see how I might structure a solution given my experiences. This is another great learning opportunity.

 

We will start these next week. However, you have likely been assigned a partner based on the preferences that you previously sent to me. The partner assignment is here. I encourage you to email with your partner and set up a time for NEXT week where you will both be ready to do some programming together [Suggestion, mid to late work week. This gives you time to apply what you learn working together when it comes time to complete the Graded Materials.]

 

Additional Textbook Activities

Some students are always asking for more practice. I get it. Practice is helpful. The following problems are entirely optional but are provided here to give you some additional practice if you are interested. They are similar to what would be on a competency demo.

  • 2.15. Multiple Choice Questions
    • The Multiple-Choice questions are probably the most like the kind of questions you will see on the next competency demo.
  • 2.16. Mixed-up Code Questions
    • You might say, "wait" we did these above as Parsons Problems. That's true, but you can actually switch these from Parsons Problems to full blown practice problems where you write the code starting with a blank window. This is called Active Write mode.
    • You change the mode to Active Write by selecting that option from the drop-down menu
    • Then you click on the "Select This Problem" button from the preview window
    • Now you can write the program starting from nothing.

 

Code Walkthroughs

The following are videos and code solutions explaining the problems above, including the Parsons Problems, Debugging Problems, and (Paired) Programming Activity. You SHOULD NOT view these until you have either solved the activities yourself and want to see how I would do it, or you have tried at least twice and are still stumped.

Don’t jump to the "correct answer" too quickly. It’s beneficial to struggle with a problem for a day or two. We improve when we meet and overcome resistance. Learning comes from practice, so make sure to TRY before jumping to the solutions.

 

 

Graded Code

Most weeks there are several Python programs that you will write as part of the Unit 2 Code Grade. Because we are only getting started this week, we will not assign formally graded work. That won't start until next week.