Types of Variable in Python and Typecasting

Python has many types of variables. Some key ones are-

  • Integer (Whole number)
  • Float (Decimal points)
  • String (Categorical)
  • Date time

It’s easy to convert one type of variable into another type, whenever possible. It’s called “Typecasting”.  Moreover, we don’t have to specify the type specifically in Python.

Python assigns the right type depending on the value we assign. Here are some examples-

Typesofvariables

Typesofvariables1

Typesofvariables2

Typesofvariables3

Cheers!

 

2 thoughts on “Types of Variable in Python and Typecasting

  1. Pingback: Learn Python Step by Step | RP's Blog on data science

  2. Pingback: Learn Data Science using Python Step by Step | RP’s Blog on Data Science