Skip to content

Latest commit

 

History

History
55 lines (33 loc) · 1.49 KB

File metadata and controls

55 lines (33 loc) · 1.49 KB

Week 01 Friday: Foundation review and calculator demonstration

Learning objectives

  • Explain debugging and tracebacks.
  • Apply today's ideas in a small Python program.
  • Inspect output and improve the program after a test run.

Concepts students must understand

  • debugging
  • tracebacks
  • problem decomposition
  • review

Detailed lesson content

Review by tracing small programs: identify inputs, transformations, and outputs. A traceback is evidence, not a failure. Demonstrate the profile programme and give useful feedback to a peer.

Before coding, describe the input, processing, and output in ordinary language. Run the smallest possible version, then extend it one change at a time. Read the error message before asking for help.

Code example

first = float(input('First number: '))
second = float(input('Second number: '))
print(f'Sum: {first + second}')

Practical coding activity

Build addition and subtraction, then test with decimals.

Guided exercise

Add multiplication and handle a zero divisor before adding division.

Independent exercise

Submit profile plus a four-operation calculator.

Expected output

The calculator prints labelled results for valid inputs.

Homework or assignment

Write a reflection: one error fixed and one concept to practise.

Recommended learning resources