Variables in Python Programming

DDSRY
2 min readMay 7, 2020

Python Variables:

What is Variable in Python Programming Language?

Variable is used to store data.

✅Variable act as containers to store values (data).

✅The values can be anything, like integer(numbers), float (decimal point numbers), string (letters, words, sentences).

✅A variable in python can be referred to using Variable names.

🔵For eg:

Library,

in the library, there are many sections that are labeled.

so if I want to put an English book, I will keep it in the section labeled as English.

Variables in Python Programming Language by DDSRY

In this example,

✅in that inside library bookshelf, it can be used to store the books.

✅Similarly, in programming, Variable act as containers to store values.

✅And just like the labels of a bookshelf,

☑️A bookshelf is a container (Variable)

☑️A label is a Variable name

example:

✅The box is a Variable, the box name is a variable name and inside that values.

🔴 3 things are required to store value in #Variable

1. Variable name

2. Assignment Operator (equal to) =

3. Value

✅For example:

name = Deepak

✅name is a variable name

✅= is an assignment operator

✅Deepak is a value, stored in the name (variable).

-we can also store text in variables.

🟠Text values are known as a string in a programming language.

✅Anything written between double quotes “ “ or single quote is a string in #python.

✅”Deepak” is a string and the “123” number inside quotes is also considered as a string in python.

✅Decimal point numbers are known as a floating-point number in programming.

✅A floating-point number refers to a number consisting of two parts separated by a decimal point.

✅A whole number is known as an integer in programming.

🟢 number=3 # an integer, 3 is an integer.

🟢 num=3.3 # an floating-point number.

🟠 If we want to find what type of value we had store then

✅ type(variable_name),

variable name inside the curved bracket.

🟥Below Statements are True about Variable :

Follow me on Instagram -> @ddsry21:

🟢Variable can be numbers and strings.

🟢Variable is a Container

🟢Variables are used to store data

🟥NOTE: we do not need to declare a variable in python.

See Thread of Tweet Below:

Variables in Python Programming Language — DDSRY

Python Podcast:

--

--