Search Header Logo
W2-L2-Variables-in-Python

W2-L2-Variables-in-Python

Assessment

Presentation

•

Computers

•

6th Grade

•

Practice Problem

•

Medium

Created by

Hatoof ATS

Used 6+ times

FREE Resource

10 Slides • 3 Questions

1

media

Variables in Python
Programming

Today we'll explore variables in Python, which are like containers that hold

data. We'll learn how to name, assign values, and perform calculations

using variables.

by Hatoof Ababneh

2

Multiple Choice

Question image

I have a variable called "age" which holds the value "10". Can you guess what kind of variable it is?

1

String

2

Integer

3

Float

4

Boolean

3

media

Introduction to
Variables

A variable is a container that stores information. Think of it like a box with

a label. The label is the variable's name, and the box holds the data.

4

media

Variable Naming
Conventions

Start with a
letter or
underscore

For example: my_variable,

name

Use only letters,
numbers, and
underscores

For example: my_variable_1

Don't use reserved words

For example: if, else, while

5

media

Assigning Values to
Variables

We use the equal sign (=) to assign a value to a variable. The variable is on

the left, and the value is on the right.

name = "Alice"

age = 12

6

media

Arithmetic
Operations with
Variables

We can use variables in arithmetic operations.

length = 5

width = 3

area = length * width

print(area) # Output: 15

7

media

Variable Types:
Integers, Floats,
Strings

Integer

Whole numbers: 1, 2, 3, -5

Float

Decimal numbers: 3.14, 2.5,

-1.2

String

Text: "Hello", "World", "Python"

8

media

Exercise: Manipulating Variables

Let's practice using variables. Create a program to store your name and age. Then, calculate how old you will be in 5 years.

go to https://www.online-python.com/ and write your answer.

media

9

10

Fill in the Blank

Question image

Write the final answer here.

11

media

Variables in Real-World Applications

Games

Variables store player scores, levels, and

health points.

E-commerce

Variables track prices, quantities, and

customer information.

Scientific Research

Variables store experimental data,

measurements, and calculations.

12

media

Equation: Area of a Rectangle (length
* width)

1
Step 1

Identify the length and width of the rectangle.

2
Step 2

Multiply the length by the width.

3
Step 3

The result is the area of the rectangle.

13

Multiple Choice

Which Python code snippet correctly calculates the area of a rectangle?

1

length = 5 width = 3 area = length + width print(area)

2

length = 5 width = 3 area = length * width print(area)

3

length = 5 width = 3 area = length - width print(area)

4

length = 5 width = 3 area = length / width print(area)

media

Variables in Python
Programming

Today we'll explore variables in Python, which are like containers that hold

data. We'll learn how to name, assign values, and perform calculations

using variables.

by Hatoof Ababneh

Show answer

Auto Play

Slide 1 / 13

SLIDE