
W2-L2-Variables-in-Python
Presentation
•
Computers
•
6th Grade
•
Practice Problem
•
Medium
Hatoof ATS
Used 7+ times
FREE Resource
10 Slides • 3 Questions
1
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
I have a variable called "age" which holds the value "10". Can you guess what kind of variable it is?
String
Integer
Float
Boolean
3
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
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
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
Arithmetic
Operations with
Variables
We can use variables in arithmetic operations.
length = 5
width = 3
area = length * width
print(area) # Output: 15
7
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
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.
9
10
Fill in the Blanks
Type answer...
11
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
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?
length = 5 width = 3 area = length + width print(area)
length = 5 width = 3 area = length * width print(area)
length = 5 width = 3 area = length - width print(area)
length = 5 width = 3 area = length / width print(area)
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
Similar Resources on Wayground
11 questions
Основные логические операции
Presentation
•
KG
9 questions
Peristiwa Kemerdekaan
Presentation
•
6th Grade
9 questions
Middle East Lesson One Vocabulary
Presentation
•
6th Grade
10 questions
Computer Network
Presentation
•
6th - 7th Grade
13 questions
Programming Quiz
Presentation
•
5th Grade
9 questions
Perimeter, Area, and Volume Class Practice
Presentation
•
5th Grade
10 questions
Composite Shapes
Presentation
•
6th Grade
9 questions
Surface Area of Prisms
Presentation
•
6th Grade
Popular Resources on Wayground
24 questions
PBIS-HGMS Day 10
Quiz
•
6th - 8th Grade
10 questions
HCS SCI 03 Summer School Review 3
Quiz
•
3rd Grade
11 questions
Home Scope
Quiz
•
7th - 8th Grade
15 questions
HCS SCI 05 Summer School Assessment 3 Review
Quiz
•
5th Grade
35 questions
Lufkin Road Middle School Student Handbook & Policies Assessment
Quiz
•
7th Grade
18 questions
Geo 11.3 Area of Circles and Sectors
Quiz
•
9th - 11th Grade