Search Header Logo
Variables

Variables

Assessment

Presentation

Computers

9th - 10th Grade

Medium

Created by

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")

1

x

2

Mr Shaw

3

"x"

4

"Mr Shaw"

8

Multiple Select

 

Identify the variables in the program:

x = "this is message one"

y = "5"

print(x, y)

1

x

2

this is message one

3

y

4

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)

1

x, y

2

"x,y"

3

this is message one 5

4

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.

1

False

2

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 ....

1

a sequence of letters, numbers and/or symbols

2

whole number

3

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 ....

1

a sequence of letters, numbers and/or symbols

2

whole number

3

digits/numbers with a decimal point

4

True/False

22

Multiple Choice

The type of a variable could be an integer if the data assigned to it were a ....

1

a sequence of letters, numbers and/or symbols

2

whole number

3

digits/numbers with a decimal point

4

False/True

23

Multiple Choice

The type of a variable could be an Boolean if the data assigned to it were a ....

1

a sequence of letters, numbers and/or symbols

2

whole number

3

digits/numbers with a decimal point

4

False/True

24

Multiple Choice

What is the data type of the variable a in this program:

a=25

print(a)

1

Float/Real

2

Boolean

3

String

4

Integer

25

Multiple Choice

What is the data type of the variable a in this program:

a=2.5

print(a)

1

Float/Real

2

Boolean

3

String

4

Integer

26

Multiple Choice

What is the data type of the variable x in this program:

x = True

print(x)

1

Float/Real

2

Boolean

3

String

4

Integer

27

Multiple Choice

What is the data type of the variable x in this program:

x = "3.25"

print(x)

1

Float/Real

2

Boolean

3

String

4

Integer

28

Multiple Choice

What is the data type of the variable b in this program:

b = "True"

print(b)

1

Float/Real

2

Boolean

3

String

4

Integer

29

Multiple Choice

What is the data type of the variable Tel in this program:

Tel = "+447788123450"

print(Tel)

1

Float/Real

2

Boolean

3

String

4

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:

1

"+447788123450"

2

+447788123450

3

Tel

4

tel

31

Multiple Choice

 

What will the be the output of following code?

x = 7

x = x+1

print(x)

1

8

2

x + 1

3

7

4

x

32

Multiple Choice

 

Predict ....

What will the following code display in the shell?

x = 7

y = 4

print(x, "+", y,"=", x+y)

1

Error

2

7 + 4 = 11

3

x + y = 11

4

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)

1

error

2

7 + 4 = 11

3

x + y = 11

4

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)

1

74

2

7 x 4 = 28

3

x x y = 11

4

7777

35

Thank you!

By Mr. Dwedari​

In computing, what is a variable? (3 Minutes)

Show answer

Auto Play

Slide 1 / 35

OPEN ENDED