ycliper

Популярное

Музыка Кино и Анимация Автомобили Животные Спорт Путешествия Игры Юмор

Интересные видео

2025 Сериалы Трейлеры Новости Как сделать Видеоуроки Diy своими руками

Топ запросов

смотреть а4 schoolboy runaway турецкий сериал смотреть мультфильмы эдисон
Скачать

Day-8|Set Methods|AI journey..🚅

Автор: B tech Bathayi 🍊🍊

Загружено: 2025-08-22

Просмотров: 126

Описание: 🔹 Other Set Methods

add() - Adds an element to the set

clear() - Removes all elements from the set

copy() - Returns a shallow copy of the set

discard() - Removes a specified element if it exists (no error if not found)

pop() - Removes and returns a random element from the set

remove() - Removes a specified element (raises error if not found)


🔹 Set Operations

difference() - Returns the difference between sets (elements in one but not the other)

difference_update() - Removes elements found in another set from this set

intersection() - Returns common elements of two or more sets

intersection_update() - Updates the set with elements found in both sets

isdisjoint() - Returns True if sets have no elements in common

issubset() - Returns True if all elements of a set are in another set

issuperset() - Returns True if a set contains all elements of another set

symmetric_difference() - Returns elements not common to both sets

symmetric_difference_update() - Updates the set with elements not common to both sets

union() - Returns a new set containing all unique elements from sets

update() - Updates the set with union of itself and others



Q1. Create a set named fruits containing "apple", "banana", and "mango".

Q2. Create two sets: A = {1, 2, 3, 4, 5} and B = {4, 5, 6, 7}. Find the intersection of A and B.

Q3. Create two sets: X = {"red", "blue", "green"} and Y = {"yellow", "blue", "black"}. Find the union of X and Y.

Q4. Create two sets: P = {10, 20, 30, 40} and Q = {30, 40, 50, 60}. Find the difference (P - Q).

Q5. Create two sets: M = {"dog", "cat", "parrot"} and N = {"cat", "rabbit", "lion"}. Find the difference (N - M).

Q6. Write Python code to create a set of numbers from 1 to 5 and another set from 4 to 8, then find both intersection and union.

Q7. Given two sets A = {2, 4, 6, 8} and B = {1, 2, 3, 4}, find:
a) A ∩ B
b) A ∪ B
c) A - B
d) B - A

Не удается загрузить Youtube-плеер. Проверьте блокировку Youtube в вашей сети.
Повторяем попытку...
Day-8|Set Methods|AI journey..🚅

Поделиться в:

Доступные форматы для скачивания:

Скачать видео

  • Информация по загрузке:

Скачать аудио

Похожие видео

© 2025 ycliper. Все права защищены.



  • Контакты
  • О нас
  • Политика конфиденциальности



Контакты для правообладателей: [email protected]