- Популярные видео
- Авто
- Видео-блоги
- ДТП, аварии
- Для маленьких
- Еда, напитки
- Животные
- Закон и право
- Знаменитости
- Игры
- Искусство
- Комедии
- Красота, мода
- Кулинария, рецепты
- Люди
- Мото
- Музыка
- Мультфильмы
- Наука, технологии
- Новости
- Образование
- Политика
- Праздники
- Приколы
- Природа
- Происшествия
- Путешествия
- Развлечения
- Ржач
- Семья
- Сериалы
- Спорт
- Стиль жизни
- ТВ передачи
- Танцы
- Технологии
- Товары
- Ужасы
- Фильмы
- Шоу-бизнес
- Юмор
19- What is tuple and set in python?
In Python, tuples and sets are both built-in collection data types, but they differ significantly in their characteristics and use cases.
Tuples:
Ordered and Immutable: Tuples are ordered sequences of elements, meaning the order in which elements are added is preserved. Once a tuple is created, its elements cannot be changed, added, or removed. This immutability makes them suitable for data that should not be modified, such as fixed configurations or records.
Allow Duplicates: Tuples can contain duplicate elements.
Indexed: Elements in a tuple can be accessed using an index, similar to lists, starting from 0.
Syntax: Tuples are defined using parentheses ().
Sets:
Unordered and Mutable (but elements are immutable): Sets are unordered collections of unique elements. While you can add or remove elements from a set, the individual elements themselves must be immutable (hashable).
No Duplicates: Sets automatically handle duplicate elements, ensuring that each element in a set is unique. If you try to add a duplicate, it will be ignored.
Unindexed: Elements in a set cannot be accessed by an index because sets are unordered.
Syntax: Sets are defined using curly braces {}.
Видео 19- What is tuple and set in python? канала TechLearn(تک لرن)
Tuples:
Ordered and Immutable: Tuples are ordered sequences of elements, meaning the order in which elements are added is preserved. Once a tuple is created, its elements cannot be changed, added, or removed. This immutability makes them suitable for data that should not be modified, such as fixed configurations or records.
Allow Duplicates: Tuples can contain duplicate elements.
Indexed: Elements in a tuple can be accessed using an index, similar to lists, starting from 0.
Syntax: Tuples are defined using parentheses ().
Sets:
Unordered and Mutable (but elements are immutable): Sets are unordered collections of unique elements. While you can add or remove elements from a set, the individual elements themselves must be immutable (hashable).
No Duplicates: Sets automatically handle duplicate elements, ensuring that each element in a set is unique. If you try to add a duplicate, it will be ignored.
Unindexed: Elements in a set cannot be accessed by an index because sets are unordered.
Syntax: Sets are defined using curly braces {}.
Видео 19- What is tuple and set in python? канала TechLearn(تک لرن)
Python Python Programming Learn Python Coding Programming Python Tutorial Python for Beginners Python Course Code With Me Python Projects Computer Science Software Development Python Basics Object Oriented Programming Online learning آموزش زبان برنامه نویسی پایتون آموزش پروژه محور کار با پروژه در پایتون آموزش آنلاین
Комментарии отсутствуют
Информация о видео
31 октября 2025 г. 12:32:10
00:24:39
Другие видео канала




















