01 Inputs%2C Variables and Outputs - Procedural Python
01 Inputs%2C Variables and Outputs - Procedural Python
Input Values which get sent from the user into the computer
Variable The place where inputs get stored by the program
Output The values which get sent from the computer to the user
Output
Did you…
1) Write the word print (with a lowercase p?)
2) Write brackets after the word print?
3) Write your name inside the brackets?
4) Write your name within quotes (inside the brackets)?
Did you…
1) Write the word print (with a lowercase p?)
2) Write brackets after the word print?
3) Write your message inside the brackets?
4) Write your message within quotes (inside the brackets)?
1. Visit coder.computerscienceuk.com/coder/
TIPS:
• You will need to use the print() statement
• To run the program, click the rocket icon!
input
()
input(“what is your
name?”)
But we also need to store what the user types in, otherwise the input will be
lost!
input(“what is your
name?”)
As we saw before, the problem with the above is that whatever the user types in, it
doesn’t actually go anywhere
We need to STORE IT…
Summary
• ‘answer’ is the variable (memory location) where the user’s input will be stored
• input(“What is your name?”) displays the “what is your name?” message onto the screen and waits for
the users input.
• Once the user has typed in their name the input is stored in the variable labelled “answer”
• print(answer) then simply displays the contents of variable “answer” onto the screen
PRINT Just
displays a
message!
INPUT Displays
a message and
waits for a user
input!
So, it needs to be assigned
to a variable if we want to
store what the user types
in…