top of page
Writer's pictureRosario Riley

Different Data Types in Python

Python is a programming language which works quickly and integrates systems more effectively in development process.


Python is a very popular programming language which was created by Guido van Rossum, and released in 1991.


Python is a multi-paradigm programming language: object-oriented programming and structured programming.


The Python syntax (words and structure) is extremely simple to read and follow, most of which can be understood even if you do not know any programming.


Python is capable of threading and GPU processing just like any other language.





Python Data Types as below:


Numeric Data Type


In Python, numeric data type is used to represents the data which has a numeric value. The numeric value can be an integer, floating number, or even complex number while declaring data type in Python.


These values can be defined as int, float, and complex classes in Python while execution program.

String Data Type


In Python the string data type is a sequence of Unicode characters. A string is generally a collection of one, two or more characters keep between the quotation mark, double-quote, or triple quote as required.


List Data Type


In Python the list data type is formed by placing all the elements of list inside square brackets [ ], separated by commas only.


The List can have any number of items which may not be of different types (integer, float, string, etc.) while execution in program.


Tuple Data Type


In Python the tuple data type is defined as an ordered collection of Python objects. The main difference between tuple and list is that tuples are immutable i.e. tuples can’t be modified after it’s created. It is represented by tuple class. In Python the we can represent tuples using parentheses ( ).


Following are the different examples of Python data types as below:-


Example


my_str = "Hello Python"

print(my_str)

print(type(my_str))


Output


Hello World

<class 'str'>


Example


num = 10

print(num)

print(type(num))


Output

10

<class 'int'>


Example

my_list = ["Apple", "Mango", "Banana"]

print(my_list)

print(type(my_list))


Output

['Apple', 'Mango', 'Banana']

<class 'list'>


Example

my_tupple = ("Apple", "Cherry", "Banana")

print(my_tupple)

print(type(my_tupple))


Output

('Apple', 'Cherry', 'Banana')

<class 'tuple'>


Example


my_range = range(5)

print(my_range)

print(type(my_range))


Output


range(0, 5)

<class 'range'>


Example

my_dict = {"name" : "Ramesh", "age" : 30}

print(my_dict)

print(type(my_dict))


Output


{'name': 'Ramesh', 'age': 30}

<class 'dict'>


TCCI provides best teaching in Python programming language through different learning method/media as per students convince.


For More Information:

Call us @ 9825618292

Visit us @ http://tccicomputercoaching.com

Recent Posts

See All

Comentarios


bottom of page