Skip to content

Latest commit

 

History

History
55 lines (33 loc) · 1.4 KB

File metadata and controls

55 lines (33 loc) · 1.4 KB

Week 01 Thursday: Input, output, and formatted profile

Learning objectives

  • Explain input and f-string.
  • Apply today's ideas in a small Python program.
  • Inspect output and improve the program after a test run.

Concepts students must understand

  • input
  • f-string
  • conversion
  • output design

Detailed lesson content

Interactive programs collect text with input. Convert numeric answers carefully and use f-strings to make outputs readable. Explain what information is required before asking for it.

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

name = input('Name: ')
city = input('City: ')
print(f'{name} is building from {city}.')

Practical coding activity

Add age and an interest to the profile script.

Guided exercise

Validate that age can be converted before calculating next-year age.

Independent exercise

Build the required personal profile feature.

Expected output

A labelled profile summary is displayed.

Homework or assignment

Finish the personal information programme and commit it.

Recommended learning resources