Page 29 - Touchcode_C6_Flipbook
P. 29
3 VARIABLES USING
BLOCK CODING
Learning Outcomes
Introduction What is Python?
What are Variables? Naming Variables
Data Types Performing Operations on Variables
Addition Operation using Block Coding
INTRODUCTION
In the previous chapters, you have learnt the basics of algorithms, flowchart and
pseudocodes. In this chapter, you are going to learn about another important component
of a program, variables. Variables are essential for storing and manipulating data in a
program. Understanding how to use variables effectively will help you write more efficient
and dynamic code.
WHAT IS PYTHON?
Python is a high level object-oriented programming language. It is a general purpose
language with interactive features. Python is an open source software and is founded by
Guido Van Rossum in 1991. Python is extensively used in:
Web Development GUI Application Development Data Analysis
Software Development Scientific Applications
WHAT ARE VARIABLES?
Variable is a name given to a location in the memory, to store values or
data. For example, you must have seen your mother naming boxes in the
kitchen. That box has a little storage capacity and your mother gave it a
name such as, salt, sugar, tea, etc. SUGAR SALT
Variables are also similar to a box or a packet. These packets can be
named, referenced and used to perform various mathematical operations.
So, a variable has a name (to refer to it), a type (kind of data it store and its size)
and a value (data). Usually variables are used to hold one or more values, result of
calculations, etc.
Scope of a variable
While creating a variable, you should also remember the limits of its usage. For example,
the boxes that your mother named, can be used in the kitchen and rarely outside the
kitchen. Similarly, a variable can also be used in specific areas of a code, known as scope of
a variable.
Variables Using Block Coding 27

