0% found this document useful (0 votes)
10 views9 pages

Variables in Python

The document outlines the concept of variables in Python, explaining that they are named memory locations used to store data during program execution. It provides rules for naming variables, emphasizing the importance of readability and conventions like using snake_case. Additionally, it includes an extended task and questions for students to reinforce their understanding of variables.

Uploaded by

mmoj.moh990
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views9 pages

Variables in Python

The document outlines the concept of variables in Python, explaining that they are named memory locations used to store data during program execution. It provides rules for naming variables, emphasizing the importance of readability and conventions like using snake_case. Additionally, it includes an extended task and questions for students to reinforce their understanding of variables.

Uploaded by

mmoj.moh990
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Variables in Python

PAGE 18 AND 19 FROM BOOK


Learning Objectives

 By the end of the lesson, students will be able to


• Analyze the concept of variables in programming for storing and
managing data.
• Evaluate the effectiveness of variable naming in making code readable.
What are variables?

Variable is a named memory location used to store data of a


given type during program execution.

How do we assign a value to a variable?


We simply use the equal sign (=) as an assignment operator, followed
by the value you want to assign to the variable. Here's an example:

Country=“UAE”
Rules for naming variables

1. Variable names must start with a letter or an underscore ( _ )


character.

2. Variable names can only contain letters, numbers, and underscores.

3. Variable names cannot contain spaces or special characters.

Variable naming conventions

Variable names should be descriptive and not too short or too long.

Use lowercase letters and underscores to separate words in


Variable names (known as "snake_case").
Extended Task:

Assign a value as 3 to the variable glass_of_water and display the


message I drank 3 glasses of water today.
Exit Ticket:

Why do programmers use variables


instead of writing values directly?
Answer the following questions:

 What are variables?


 Write the rules for naming the variables.
 Answer the Exit ticket question.
 Do the extended task.
 Do the individual task.
Other Resource:

 https://www.youtube.com/watch?v=e5Yv5uG4
kZk

 Scan and play the quiz.

You might also like