
Variables
Presentation
•
Computers
•
9th - 10th Grade
•
Medium
M Dwedari
Used 19+ times
FREE Resource
15 Slides • 20 Questions
1
Open Ended
In computing, what is a variable? (3 Minutes)
2
Remember ....
A variable is a named storage location in memory that holds a value which can change while the program is executed.
By naming a variable, you can access the data assigned to it easily throughout the program.
A variable can hold one value (piece of data) at a time. This value can change throughout the execution of a program. When a new value is placed in (or assigned to) a variable, it replaces the last value.
By Mr. Dwedari
3
Identify the variables within a program.
Understand data types
Identify and describe what a program does.
Debug a program
Learning Objectives:
Some text here about the topic of discussion
4
What do you think this program does and why?
Think, Pair, Share ....
By Mr. Dwedari
personName = "Mr Shaw"
print(personName)
5
Explanation ...
What do you think this program does?
By Mr. Dwedari
This is the variable identifier --->personName = "Mr Shaw"
print(personName)<---This prints the value stored
in the variable
6
Try another one...
What is the variable in this program? What would it print out?
x = "Mr Shaw"
print("x")
7
Multiple Choice
Identify the variables in the program?
x = "Mr Shaw"
print("x")
x
Mr Shaw
"x"
"Mr Shaw"
8
Multiple Select
Identify the variables in the program:
x = "this is message one"
y = "5"
print(x, y)
x
this is message one
y
5
9
This is a variable. ---->x = "this is message one"<----Data type and value
This is a variable. ----> y = "5" <----Data type and value
Explanation
Identify the variables in the program:
print(x, y)
10
x = "this is message one"
y = "5"
print(x, y)
What will the last line output?
11
Multiple Choice
What will be displayed using
x = "this is message one"
y = "5"
print(x, y)
x, y
"x,y"
this is message one 5
error
12
Multiple Choice
In Python, you can assign different types of data to variables, and the choice of data type is crucial because it determines how the data is stored and what kind of operations can be performed on it.
False
True
13
Examples:
x = "My name is Oscar"
y = 8.4
age = 18
Mobile = "+447751234567"
postcode= "M46 1AA"
s = "18"
answer= False
Note: With Boolean variables, the first letters of True or False must be in uppercase
Data Types
Different types of data can be assigned to variables
<<< String (a sequence of letters, numbers and/or symbols)
14
Examples:
x = "My name is Oscar"
y = 8.4
age = 18
Mobile = "+447751234567"
postcode= "M46 1AA"
s = "18"
answer= False
Note: With Boolean variables, the first letters of True or False must be in uppercase
Data Types
Different types of data can be assigned to variables
<<< String (a sequence of letters, numbers and/or symbols)
<<< Float/ Real (a number with decimal point)
15
Examples:
x = "My name is Oscar"
y = 8.4
age = 18
Mobile = "+447751234567"
postcode= "M46 1AA"
s = "18"
answer= False
Note: With Boolean variables, the first letters of True or False must be in uppercase
Data Types
Different types of data can be assigned to variables
<<< String (a sequence of letters, numbers and/or symbols)
<<< Float/ Real (a number with decimal point)
<<< Integer (a whole number)
16
Examples:
x = "My name is Oscar"
y = 8.4
age = 18
Mobile = "+447751234567"
postcode= "M46 1AA"
s = "18"
answer= False
Note: With Boolean variables, the first letters of True or False must be in uppercase
Data Types
Different types of data can be assigned to variables
<<< String (a sequence of letters, numbers and/or symbols)
<<< Float/ Real (a number with decimal point)
<<< Integer (a whole number)
<<< String
17
Examples:
x = "My name is Oscar"
y = 8.4
age = 18
Mobile = "+447751234567"
postcode= "M46 1AA"
s = "18"
answer= False
Note: With Boolean variables, the first letters of True or False must be in uppercase
Data Types
Different types of data can be assigned to variables
<<< String (a sequence of letters, numbers and/or symbols)
<<< Float/ Real (a number with decimal point)
<<< Integer (a whole number)
<<< String
<<< String
18
Examples:
x = "My name is Oscar"
y = 8.4
age = 18
Mobile = "+447751234567"
postcode= "M46 1AA"
s = "18"
answer= False
Note: With Boolean variables, the first letters of True or False must be in uppercase
Data Types
Different types of data can be assigned to variables
<<< String (a sequence of letters, numbers and/or symbols)
<<< Float/ Real (a number with decimal point)
<<< Integer (a whole number)
<<< String
<<< String
<<< String (whole number but surrounded by " ". Therefore it is String )
19
Examples:
x = "My name is Oscar"
y = 8.4
age = 18
Mobile = "+447751234567"
postcode= "M46 1AA"
s = "18"
answer= False
Note: With Boolean variables, the first letters of True or False must be in uppercase
Data Types
Different types of data can be assigned to variables
<<< String (a sequence of letters, numbers and/or symbols)
<<< Float/ Real (a number with decimal point)
<<< Integer (a whole number)
<<< String
<<< String
<<< String (whole number but surrounded by " ". Therefore it is String )
<<< Boolean (only False/True can be assigned to this variable)
20
Multiple Choice
The type of a variable could be string if the data assigned to it were a ....
a sequence of letters, numbers and/or symbols
whole number
digits/numbers with a decimal point
21
Multiple Choice
The type of a variable could be an float/Real if the data assigned to it were a ....
a sequence of letters, numbers and/or symbols
whole number
digits/numbers with a decimal point
True/False
22
Multiple Choice
The type of a variable could be an integer if the data assigned to it were a ....
a sequence of letters, numbers and/or symbols
whole number
digits/numbers with a decimal point
False/True
23
Multiple Choice
The type of a variable could be an Boolean if the data assigned to it were a ....
a sequence of letters, numbers and/or symbols
whole number
digits/numbers with a decimal point
False/True
24
Multiple Choice
What is the data type of the variable a in this program:
a=25
print(a)
Float/Real
Boolean
String
Integer
25
Multiple Choice
What is the data type of the variable a in this program:
a=2.5
print(a)
Float/Real
Boolean
String
Integer
26
Multiple Choice
What is the data type of the variable x in this program:
x = True
print(x)
Float/Real
Boolean
String
Integer
27
Multiple Choice
What is the data type of the variable x in this program:
x = "3.25"
print(x)
Float/Real
Boolean
String
Integer
28
Multiple Choice
What is the data type of the variable b in this program:
b = "True"
print(b)
Float/Real
Boolean
String
Integer
29
Multiple Choice
What is the data type of the variable Tel in this program:
Tel = "+447788123450"
print(Tel)
Float/Real
Boolean
String
Integer
30
Multiple Choice
Use Python Online to test the following code then answer the question (5 minutes)
Tel = "+447788123450"
print("Tel")
What is the output of this program:
"+447788123450"
+447788123450
Tel
tel
31
Multiple Choice
What will the be the output of following code?
x = 7
x = x+1
print(x)
8
x + 1
7
x
32
Multiple Choice
Predict ....
What will the following code display in the shell?
x = 7
y = 4
print(x, "+", y,"=", x+y)
Error
7 + 4 = 11
x + y = 11
74
33
Multiple Choice
Use Python Online to test the following code then answer the question (5 minutes)
What will the following code display in the shell?
x = 7
y = 4
print(x, "+", y,"=", x+y)
error
7 + 4 = 11
x + y = 11
74
34
Multiple Choice
What will be the output of the following code ? (1-minute)
x = 7
y = 4
print(x, "x", y,"=", x*y)
74
7 x 4 = 28
x x y = 11
7777
35
Thank you!
By Mr. Dwedari
In computing, what is a variable? (3 Minutes)
Show answer
Auto Play
Slide 1 / 35
OPEN ENDED
Similar Resources on Wayground
27 questions
COMANDOS DOS
Presentation
•
KG
26 questions
Turtle Introduction
Presentation
•
9th - 10th Grade
26 questions
for while break continue
Presentation
•
KG
31 questions
Cell division terms 2 - mitosis prep
Presentation
•
10th Grade
30 questions
The Computer - Lesson 1
Presentation
•
10th Grade
26 questions
Rhetoric Lesson
Presentation
•
9th - 11th Grade
26 questions
Network Topologies-Sta Cruz
Presentation
•
10th Grade
30 questions
Cyber Security Lesson 4
Presentation
•
10th Grade
Popular Resources on Wayground
15 questions
Grade 3 Simulation Assessment 1
Quiz
•
3rd Grade
22 questions
HCS Grade 4 Simulation Assessment_1 2526sy
Quiz
•
4th Grade
16 questions
Grade 3 Simulation Assessment 2
Quiz
•
3rd Grade
19 questions
HCS Grade 5 Simulation Assessment_1 2526sy
Quiz
•
5th Grade
17 questions
HCS Grade 4 Simulation Assessment_2 2526sy
Quiz
•
4th Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
24 questions
HCS Grade 5 Simulation Assessment_2 2526sy
Quiz
•
5th Grade
20 questions
Math Review
Quiz
•
3rd Grade
Discover more resources for Computers
10 questions
Exploring Digital Citizenship Essentials
Interactive video
•
6th - 10th Grade
20 questions
Inventor Terms Exercise #1a
Quiz
•
9th Grade
31 questions
Inventor Vocabulary Review Sheet
Quiz
•
9th Grade
10 questions
Exploring Cybersecurity Techniques and Threats
Interactive video
•
6th - 10th Grade