Before you start this course, you must login to Replit

If you have forgotten your Replit account user name or password, ask your Coder Coach.


3.0-Basic Input Overview

Basic Input:

Students learn how to use the input() command to assign strings to variables.


This topic adds the input command to the prior learning about print and variable assignment.

Learning Objectives/Goals

Students will learn to interpret, trace, identify and create python code that uses:

Concept Explanation Python Code Examples
Strings The text data type. All string data is treated as text, even if it is numerical characters. “string goes here” “This is a string”
Variable assignment Putting data into a variable. = num1 = 10 name = “Andy”
Concatenation Joining string literals (text in speech marks that prints exactly as it appears in the code) to the contents of variables in output, or joining the contents of variables together. There are several ways of doing this, but I’ve used the plus symbol in my exercises. + print(“Hello ” + name) fullName = firstName + lastName
Input Collecting data for processing. In these examples we collect input that the user types on the keyboard but computers collect input in lots of ways – as sound, mouse movements, with sensors etc. ** Input must ALWAYS be assigned to a variable** or it will not be stored. All input is treated as strings. Any input that needs to be treated as a number must be cast into the new format. variableName = input() print(“What’s your name?”) name = input() print(“Guess the secret number” guess = int(input())

Slide Deck

[The slide deck for this topic can be found here] (


Each skill has 3-4 individual projects associated with it that take students through the PRIMM pedagogical framework. They are numbered to try and make the order obvious. You can assign these one at a time or drip feed as students get to them.


Prior Learning

  • Algorithms – Sequences of instructions for a task. You can learn more about algorithms here:,in%20order%20to%20accomplish%20a%20certain%20predefined%20task.

  • Output/Print – The information presented to the user by the computer. In our programs output will be in the form of text on screen. You can find more about output/print here:

  • Strings – Data in text format. You can find out more about strings here:

  • Syntax – the format that code is written in. If code is not written in the correct format it creates a **syntax error **and the program will not run. You can find more about syntax here:

  • Variable – a placeholder for information that can change as the program runs. You can find out more about variables here:

  • Variable assignment – Using the ‘=’ symbol to store data in a variable. You can find out more about variable assigment here:

  • Concatenation – joining the contents of variables to other variables and/or strings in output.

New Learning

  • Input – the data collected by the computer. In our programs input will be in the form of the user typing in. Input must be assigned to a variable or it will be discarded by the program.

There are lots of similar tasks available online that you can use to supplement the ones in these resources. I can particularly recommend:

The input/process/output diagram on the lesson slides will be referred back to in future sessions.

It’s important to ensure that students understand the difference between algorithm and program.

Once you have explained this we move on to coding output using the print statement. This is one of the simplest commands in Python. It offers instant feedback (users can see if it works or not straight away). When students have had a chance to predict & test, start to explore how to break the statement. This will give you a chance to highlight the importance of precision and correct syntax in programming. I find it really helps if students appreciate this very early on.

At first, you start with printing set text (called strings). In later tasks you use variables to store text and refer back to it. Variables are used in a very similar way to letters in algebra – they represent the text. Students can call variables anything they like, but there are some good practice principles:

Help! My Code Does Not Work!

Make sure to look out for the following things:

  • Students put the data into the brackets after the input command eg:
print("What's your name?")
name = input("Andy")
  • Missing brackets after the ‘input’
  • Not pressing enter after typing in the input.
  • Not assigning the input to a variable