Python Data Types- Basic

A data type is the kind of value stored in a variable, passed to function or returned by a function. It also defines the kind of value calculated by an expression consisting of values and operators. So, to proceed further let’s explore Python data Types that we are going to use in this post and upcoming python programming concepts

Python Data Types


This data type can be used when you need numeric values without the decimal part. Or you can say whole numbers. The int data type represents all the signed integers with no limit on their length. Signed means integers can be positive or negative. No sign implies positive.

Examples of Integer numbers in Python Data Types

marks= 123                                        a positive Integer

scale = -20                                         a negative Integer

count= 0                                zero-valued variable


This data type can be used when you need numeric values without a decimal part but the value is quite a bit, say scientific numeric.  They still are whole numbers. The long data type represents all the long integers. The representation  is similar to an integer with the difference that a long number is far bigger than the maximum integer value.

Examples of Long numbers in Python

AgeOF Earth= 45430000737922             a positive Long Integer

scale = -264683939920                a negative Long Integer


When you need numbers that have decimal parts in your program then you define them as float. The precision part of a float provides an accuracy of a maximum of 15 decimal places. You can assign value to a floating-point variable using scientific notation with E or e. It represents a large value having decimal in power of 10.


EarthRadius= ‎6.3781e6


This data type is best for mathematical calculations involving complex numbers. The numbers are stores in the form of a+ib, where a and b are numbers and i is iota

CompNum= 4 + 6i.


Str represents a collection of characters taken from possible symbols on your keyboard. Python data type strings are to be enclosed within single quotes. If you wish to include a single quote (”) as apostrophe you must enclose such a string in double quotes (“”)

Examples of str

Msg1=‘Hello! World’

Msg2=“Hello! World”

Msg3= “Python’s is amazing”

Str variables in Python are immutable. When you try to update or delete a single character in a predefined string it is disallowed. You cannot change a character or characters in a string data type variable in Python. But Python does allow replace the existing string variable with a new value or delete it altogether.

Python String Data Type
Python Data Type – String

These are the standard and basic Python Data Types. You can read more about these in official Python documentation.

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *