Home » Home » Variables and DataTypes in Python

Variables and DataTypes in Python


Variable in python is reserved memory location which is used to store data or values. In other words, a variable in a python program gives data to the computer for processing. Declaring and re-declaring a variable in Python is as easy as writing names and assigning values to it.

there are many types of data that get stored like integer, decimal or float, String or text, binary data.so, In order to represent these data in python we use variable with specific name like x,y,z,….

Lets go with Example of BMI (Body Mass Index) :

height = 1.79
weight = 68.7
bmi = weight / height ** 2

Output : 21.4413


Datatype in python is type of data which we store into system using variables.As we have mentioned earlier there are many datatypes and there can be as many as 4 , 7 or even more datatype depend upon what kind of programming language we use , But In python There are mainly 4 datatypes and rest are mainly objects of class like list, tuple, dictionary about which we will discuss later.

DataTypes in python :

  • integer or int – 1,2,3,4
  • float – 1.23,32.1
  • string – "hello" or 'hello'
  • bool – 1 and 0 or True and False

Related Posts

Leave a Reply

%d bloggers like this: