Week 7
Working with IPO Problems

Weekly Summary

This week we will be looking at how we take the various mathematical expressions, variable assignment statements, and print statements that we learned about last week, and putting them together in small algorithms/programs (often referred to as "scripts" in the Python community).

Recall from our prior Scratch Unit that we defined algorithms and programs as:

One of the easiest types of algorithms to look at when we are just starting with Python is the concept of IPO Problems. IPO stands for:

  • Input
  • Process
  • Output

As the name implies, these are basic problems that

  • asks the human user for some input
  • performs some processing on that input to calculate a result
  • displays or outputs that result back to the human user

They tend to be relatively trivial and "simple" problems. But they are a great place for us to get started understanding how individual python statements/expressions can be put together to solve a task (an "algorithm" or "program").

 

Learning Outcomes

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

  • Reading Code
    • Given a sequence of code using input statements, mathematical expressions, and print statements (IPO problem), determine the results of executing the code.
    • Given a problem statement and several segments of code, identify which segment will solve the problem statement.
  • Writing Code
    • Given an IPO problem statement, write the python code that will solve the problem.
  • Debugging Code
    • Given a problem statement and a non-working program that attempts to solve the problem, identify where the code is incorrect and explain how to fix it.

 

Learning Materials

 

Our Lessons - Creating IPO Scripts

 

Textbook Readings

 

The Use of AI in computer program

 

How to Use Autolab

  • VIDEO: How to use Autolab
  • Carnegie Mellon has produced a free server called Autolab that universities like UNI can use to help us manage large numbers of code submissions AND allow you to get some timely and meaningful feedback.
  • This video explains how to use the tool in this course.

 

Practice Materials

 

Parsons Problems

Chapter 3 didn't add enough to add new code practice. So the following problems were created by me and use a specialized Parsons Problem website. They are provided to give you some additional practice on the material from Chapter 2 while focusing more on the IPO format we are emphasizing this week..

  1. Bob's Burgers Cash Register
  2. Converting Minutes to Hours and Minutes
  3. Change from a parking lot vending machine
  4. Converting dollars to Euros

"Solutions" for these four programs 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. The following problem is designed to give you semi-guided practice in debugging.

  1. Calculating the final cost with tax

The solution for this program is included in the Code Walkthrough section below.

 

(Paired) Practice Programs

As a repeat from last week, 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.

 

 

Additional Textbook Activities

  • 2.17. Write Code Questions
    • Unlike the materials in Section 2.16 (that you used last week) these can't be toggled back and forth between Parsons Problems or Write Code problems.
    • Instead, these are some additional (and completely optional) opportunities to practice writing code.

 

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 Materials

The following programs are formally graded as part of the Unit 2 “Problem Set.” You should work on these individually. While working on these problems, you may refer to your notes, textbook, any programs you wrote, and my videos. However, you should significantly restrict your discussions with classmates. It is moderately acceptable to discuss how you solved a problem in general terms, but you should never show your code to a classmate, whether you are the one struggling or the one helping. You can talk about ideas, but not specific solutions.

Don't forget about the concept of Rubber Duck Debugging. If you are getting stuck this week you should absolutely pull out your rubber duck and talk to it. YES, you will feel foolish at first. But, again, the research shows that by talking out loud you can often (not always, but often) figure things out on your own. TRY IT!