Week 7

Ask and Answer

Aim: Ask the user questions and use their answers.

New coding words

  1. input
  2. prompt
  3. response
  4. f-string
  5. user

What the coding words mean

  1. input: A command that waits for someone to type an answer.
  2. prompt: The question or message asking the user to type something.
  3. response: The answer entered by the user.
  4. f-string: Text beginning with f that can display values inside curly brackets.
  5. user: The person using the program.
Code along

Ask and use two answers

Ask the user two questions and place their answers inside friendly messages.

Python coding spaceReady to run
.py

Tab indents. Esc then Tab leaves the editor. Ctrl/⌘ + Enter runs your code.

Output (Shell)What your program does
Select Run my code to try this program.
Opening your coding space…Each activity has its own saved code.
Mini project

Friendly Chatbot

Build a friendly chatbot that remembers and responds to three answers.

Python coding spaceReady to run
.py

Tab indents. Esc then Tab leaves the editor. Ctrl/⌘ + Enter runs your code.

Output (Shell)What your program does
Select Run my code to try this program.
Opening your coding space…Each activity has its own saved code.

Your mini-project to-do list

0 of 4 completed

Complete these activities in the mini-project editor above. After each change, select Run my code to check your program’s output or drawing.

Save your finished mini project

Select Download my work and save the file as week_7_friendly_chatbot.py. The .py ending tells us that the file contains Python code. Keep this file as a copy of your finished program.

Debugging detective

Chi Opara, your course guide

Knowledge check

Question 1

Which command waits for the user to type an answer?

Choose one answer
Question 2

Write an f-string that says hello using the value stored in name.

Your answers are checked in this browser and are not submitted.

How are you getting on so far?

My checklist

Finished Week 7?

This progress is saved only in this browser.