Variables in python

Viraj Wadate
Jun 27, 2021

What is a variable?

Variable is a memory block in RAM. Python is dynamically typed language so we don’t have to define the data type of the variable.

How to define variable in python?

Syntax:
variable_name = value
Example1:
num = 100
#Here num is variable which is holding 100 as value.
# In order to check data type of variable we can use type built-in function.
type(num)
#OUTPUT
int
Example2:
name = 'viraj'
# Now name string type of variable based on value
type(name)
#OUTPUT
str
Example3:
amount = 987.99
type(amount)

#OUTPUT
float

--

--

Viraj Wadate

Hi Everyone, I am a software developer from Pune. I am a passionate programmer also I post video related programming on my YouTube channel VirajWadate