Variables in Python

Variables in python generally not required to mention the data type before the variable name.

Variable is a named representation of a memory location.

In simple, the system selects one location in memory for your value to be stored, but the "address of memory location" is hard to remember, so we use a simple english as a variable name to represent that memory location.

we will see the declaration of variables in the python.

Ex:

#following line stores an integer in x variable
x=8
print(x) #output is 8

We can do multiple declarations of integer values is as follows

x=10
y=20
print(x,y) # output is 10 20

#Another way of writing the same

x,y=10,20 # Here, x is 10 and y is 20
print(x,y) # output is 10 20

Floating point values can be stored in variables, follow the same syntax as integers.

Ex:

x=3.142
print(x) #prints 3.142 as output

We can assign a string value to a variable

Ex:

x='programming9.com is a programming website'
print(x) 
# Above line prints the programming9.com is a programming website as an output

We can also assign a Boolean value to the variable

Ex:

#Boolean values must be True or False
x=True
print(x)
# the above line prints the True as an output

One important point is, in True or False, T and F are capital letters. That is, you must always right True (T is capital letter) or False (F is capital letter).