You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

4.8 KiB

Unit 4 Lab: Carefully Adding a Bit More Logic


Lesson Objectives

  • Apply what youve learned in Unit 4 to create a working Python program.
  • Wrap up Unit 4.
  • Q&A and transition.

You Do: Unit 4 Lab — Troubleshooting

Do you remember the last unit lab? You added structure to your movie app using dictionaries and classes.

In today's lab, you will add error-checking, string formatting, and a while loop (but not an infinite one!), slightly restructuring the code as you go.

Open the unit-lab-4-directions file to see the lab and its instructions. Follow the instructions there.

  • If your solution to the last lab didn't quite work, there's working code provided in the starter-code folder. Copy that to your local folder and work from there.

Try your best! Raise your hand if you really need help.


Debrief: Unit 4 Lab — Troubleshooting

How did it go?

Let's go over it.

Make sure you understand and that your code works — the Unit 5 lab builds off this one!


Unit 4 Wrap-Up

What did we cover?

  • Variable scope: Using the global keyword to access global variables.
  • The order of scope precedence that Python follows when resolving variable names.
  • Creating floats and flooring division.
  • Formatting strings.
  • Troubleshooting common types of errors.
  • Implement basic try/except mitigation.
  • Adding print statements to help debugging.

Questions?