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

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s