Set Methods in Python | Python Tutorial - Day #32

preview_player
Показать описание
Python is one of the most demanded programming languages in the job market. Surprisingly, it is equally easy to learn and master Python. This python tutorial for absolute beginners in Hindi series will focus on teaching you python concepts from the ground up.

python, C, C++, Java, JavaScript and Other Cheetsheets [++]:

►Learn in One Video[++]:

►Complete course [playlist]:

Follow Me On Social Media
Comment "#HarryBhai" if you read this 😉😉
Рекомендации по теме
Комментарии
Автор

The method related to sets are:-
1) union()---->creates a new set with the unique elements from both the sets
on a set itself and it also adds unique elements from the both the sets into one of the sets
3) intersection()----> creates a new set with the common elements from both the sets
applied on a set itself and it also contains the common elements from both the sets
creates a new set with the elements from the both the sets that are not common in between
applied on a set itself and it contains elements from the sets that are not common inj between
creates a new set with the elements from a single set that are not common
8) applied on a set itself and contains elements of a set that are not common

9)isdisjoint()---->checks if there are common elements between two sets
10)issuperset----> checks if a set is a superset of another set
11) checks is a set is subset of another set
to add a element into a set
13) to remove an elements from a set, but raises key error if the element is not present in the set
14) to remove an element from a set, does not raises error if the lement is not present in the set
15) not method, a keyword, to delete the complete set
16) to clear all the elements of a set
17) in keyword used to check if a element is present in the set or not
18) to remove a random element from the set and also we can get that element

khemchand
Автор

Present from Bangladesh Brother....#Day32 Done

In Python, a set is a collection of unique elements. Sets are used to store multiple items in a single variable. Set items are unordered, unchangeable, and do not allow duplicate values.

Here are some common methods that you can use with sets in Python:

add(): Adds an element to the set
clear(): Removes all the elements from the set
copy(): Returns a copy of the set
difference(): Returns the difference between two or more sets as a new set
difference_update(): Removes the items in this set that are also included in another, specified set
discard(): Removes an element from the set if it is present
intersection(): Returns the intersection of two sets as a new set
intersection_update(): Removes the items in this set that are not present in other, specified sets
isdisjoint(): Returns True if two sets have a null intersection
issubset(): Returns True if another set contains this set
issuperset(): Returns True if this set contains another set
pop(): Removes and returns an arbitary set element. Raise KeyError if the set is empty
remove(): Removes an element from the set. If the element is not present, raises a KeyError
symmetric_difference(): Returns the symmetric difference of two sets as a new set
Inserts the symmetric differences from this set and another
union(): Returns the union of sets in a new set
update(): Updates the set with the union of this set and others

eashovon
Автор

some important to cover in this series as new than previous courses:
1) recap __init__(main):
2) turtle tutorial
3) taste of machine learning

factzandcode
Автор

That's why maths is important for coding 👍😊

midhattech
Автор

Harry bhai aap Sandeep Maheshwari se mil ne jai ye na me bohot existed hu aap ki struggling story jan ne ke liye aap ki story hame inspiration degi

dilipgurjar
Автор

Day #32 done. This video contained lots of info regarding the set methods. Great way explanation 👍

mariamhasan
Автор

Shukra h maths padhi thi acche se, nhi to ab waps pdhni pdhti.
Harry Bhai ❤️❤️❤️❤️

thepreek
Автор

Your are noble teacher on plants Earth who Never ask for to buy her paid courses.

mahsanbhai
Автор

day 32 present
i made a function to check if a number is present in given set or not(just for fun)
s5={2, 4, 6, 8, 10, 12, 14, 16}

def check_presence(n, s):
if n in s:
return f"{n} is here"
else:
return f"{n} is absent"

print(check_presence(123, s5))


//output//
123 is absent

alirazajafri
Автор

Thank god you posted this I was waiting for this
Thank you for your inspiration 💐

mowais
Автор

Thank you sir your this two sets video's help me for my tomorrow presentation 😊🤗

AshwiniPatilVishwarupe
Автор

In my class 8 set subject is there but at that time I think this is unusefull for me but now it completely worthfull 👍

bibeksamal
Автор

Present #32 day
You makes learning as fun and uderstable

sunilkumarsb
Автор

Hey Harry few days I am unwell, but today I am well and I continu my challenge. *I am present bhaiya*

qzarmy
Автор

Sir I found this course late but today I'm at day #32
My dream is to become a software developer and I'm in class 6
Some ppl might not believe the I'm in class 6
But I'm still able to understand the concept
I also created the KBC program
Sir you are a great teacher
Peace :)

animabehera
Автор

#day32 consistency maintain
20:29 2/12/2022

satyampandey-fxgz
Автор

❤❤ love u harry bhai ❤❤❤ from odisha Jay jagganath❤

leagendff
Автор

In first video more than 470k views and hey took a promise and now we are here with 4.6 k views
.shows that only 1% in life are serious and become successful

aaditya_aspirant
Автор

All set method generate by ChatGPT AI:
-> add(elem): Adds an element to the set. If the element is already present in the set, it has no effect.
-> clear(): Removes all elements from the set.
-> copy(): Returns a shallow copy of the set.
-> difference(other_set): Returns a new set that is the difference between the set and other_set. The difference is defined as the set of elements that are present in the original set but not in other_set.
-> difference_update(other_set): Removes all elements from the set that are also present in other_set.
-> discard(elem): Removes an element from the set if it is present. If the element is not present, it has no effect.
-> intersection(other_set): Returns a new set that is the intersection between the set and other_set. The intersection is defined as the set of elements that are present in both the original set and other_set.
-> Removes all elements from the set that are not present in other_set.
-> isdisjoint(other_set): Returns True if the set and other_set have no elements in common, and False otherwise.
-> issubset(other_set): Returns True if the set is a subset of other_set, and False otherwise.
-> issuperset(other_set): Returns True if the set is a superset of other_set, and False otherwise.
-> pop(): Removes and returns an arbitrary element from the set. If the set is empty, it raises a KeyError exception.
-> remove(elem): Removes an element from the set. If the element is not present, it raises a KeyError exception.
-> Returns a new set that is the symmetric difference between the set and other_set. The symmetric difference is defined as the set of elements that are present in either the original set or other_set, but not both.
-> Removes all elements from the set that are also present in other_set, and adds all elements that are present in other_set but not in the set.
-> union(other_set): Returns a new set that is the union of the set and other_set. The union is defined as the set of elements that are present in either the original set or other_set, or both.
-> update(other_set): Adds all elements from other_set to the set.

milestips
Автор

even in udemy paid course, they never teach things such step by step, big thanks.

tanvirgsm