Variables in python
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
intExample2:
name = 'viraj'
# Now name string type of variable based on value
type(name)
#OUTPUT
strExample3:
amount = 987.99
type(amount)
#OUTPUT
float