Input
Input
Lesson 4: Input
Rebecca Franks
Materials from the Teach Computing Curriculum created by the National Centre for Computing Education
In this lesson you will:
2
Make predictions
Questions .
What will be the output of print, when
age = 22 this program is executed?
print(f"My age is {age}") A. My age is age
B. My age is 22
C. It is not possible to know the
output without executing the
program
D. There is an error in the program
3
Make predictions
Questions .
What will be the output of print, when
print(f"My age is {age}")
this program is executed?
age = 22
A. My age is age
B. My age is 22
C. It is not possible to know the
output without executing the
program
D. There is an error in the program
4
Make predictions
Questions .
What will be the output of print, when
age = 22
this program is executed?
age = 23
print(f"My age is {age}") A. My age is 45
B. My age is 22,23
C. My age is 23
D. There is an error in the program
5
Make a prediction
6
Walking through the code
Input / Output .
7
Walking through the code
Input / Output .
8
Walking through the code
Input/Output .
9
Walking through the code
Input/Output .
10
Walking through the code
Input/Output .
11
Walking through the code
Input/Output .
Hello is displayed on the screen with the text What is your name?
Rebecca
that was input and held in the name
Hello Rebecca
variable.
12
Types of data
13
Types of data
5.2
“a”
14
Types of data
True
5.2
“a”
15
Types of data
5.2
“a”
16
Types of data
5.2
“a”
17
Types of data
“a”
18
Types of data
19
Types of data
20
Types of data
21
Types of data
22
Types of data
Enter a number
1
Enter another number
2
3
>>>
23
Input, process, and output of input()
24
Input, process, and output of int()
25
Types of data
26
Types of data
27
Types of data
28
Types of data
oaknat.uk/comp-pythonfunctions
29
Match the data types to their examples
Boolean “a”
String 5.2
Char “Hello”
Real/float 283
Integer False
30
Match the data types to their examples
Boolean “a”
String 5.2
Char “Hello”
Integer False
31
Match the data types to their examples
Boolean “a”
String 5.2
Char “Hello”
Integer False
32
Match the data types to their examples
Boolean “a”
String 5.2
Char “Hello”
Integer False
33
Match the data types to their examples
Boolean “a”
String 5.2
Char “Hello”
Integer False
34
Match the data types to their examples
Boolean “a”
String 5.2
Char “Hello”
Integer False
35