Python 2a - Inputting Strings

Inputting Strings in Python

string is a collection of characters (letters, numbers and punctuation) such as: “Wednesday”, “Toy Story 4” or “Boeing 747”.

You must include speech marks when writing a string.

Use the input command to ask a question and let a user input data.

After input, you write your question in brackets and speech marks (just like when you print).


The user’s answer must be saved into a variable (e.g. name) which is written first.

Type your answer in the shell

You can then use that variable for other purposes, such as printing it within a sentence:


Always choose an appropriate name when using variables.

Practice Task

1. Write an input line to ask the user how they are feeling.

2. Write a print line that responds to their answer, using their response.

3. Write an input line to ask the user their country of birth.

4. print a suitable statement that uses their response.

Example solution:

© CSNewbs 2020