difference between list, tuple, set in python

Опубликовано: 11 Август 2023
на канале: TomTech
87
0

Python provides us with a number of in-built data structures such as lists, tuples, sets, and dictionaries that are used to store and organize the data in an efficient manner. In this article, we will learn the difference between them and their applications.

Python List
Python Lists are just like dynamic-sized arrays, declared in other languages (vector in C++ and ArrayList in Java). Lists need not be homogeneous always which makes it the most powerful tool in Python.

Applications of Python List
Used in JSON format
Useful for Array operations
Used in Databases
Python Tuple
A Tuple is a collection of Python objects separated by commas. In some ways, a tuple is similar to a list in terms of indexing, nested objects, and repetition but a tuple is immutable, unlike lists that are mutable.

Applications of Python Tuple
Used to insert records in the database through SQL query at a time.Ex: (1.’sravan’, 34).(2.’geek’, 35)
Used in parentheses checker
Python Set
A Python Set is an unordered collection data type that is iterable, mutable and has no duplicate elements. Python’s set class represents the mathematical notion of a set.

Applications of Python Set
Finding unique elements
Join operations


На этой странице сайта вы можете посмотреть видео онлайн difference between list, tuple, set in python длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь TomTech 11 Август 2023, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 87 раз и оно понравилось 0 зрителям. Приятного просмотра!