Chris Antony Correya
@antony_chris
Followers
73
Following
199
Media
15
Statuses
124
https://t.co/aaYYyk1win student at RSET'23๐ | Python Developer ๐ | Passionate about Machine Learning ๐ค | Constantly exploring new possibilities in the world of tech
Joined September 2020
4/ And to find the difference between two sets: difference_set = set1 - set2 # or use set1.difference(set2)
0
0
0
3/ To find the intersection of two sets: intersection_set = set1 & set2 # or use set1.intersection(set2)
0
0
1
2/ To find the union of two sets: set1 = {1, 2, 3} set2 = {3, 4, 5} union_set = set1 | set2 # or use set1.union(set2) # union_set is now {1, 2, 3, 4, 5}
0
0
0
1/ Sets automatically remove duplicates, ensuring only unique values are stored. So, if you try to add a duplicate, it won't change the set.
0
0
0
Dose 16 - Sets in Python are like collections of unique elements. They're defined using curly braces or the set() constructor. For example: my_set = {1, 2, 3} ๐งต #Python #Sets #CodingCommunity
4
0
1
5/ ๐ Check membership with 'in'. Example: check = 2 in my_tuple # True
0
0
0
4/ ๐ Find element count using len(). Example: count = len(my_tuple) # 3
0
0
0
3/ ๐ Concatenate tuples with "+". Example: combined_tuple = my_tuple + (4, 5) # (1, 2, 3, 4, 5)
0
0
0
2/ ๐ Slicing extracts subsets. Example: subset = my_tuple[1:3] # (2, 3)
1
0
0
1/ ๐ Access elements by index (0-based). Example: first_element = my_tuple[0] # 1
0
0
0
Dose 15 - A tuple in Python is like a list, but immutable. You create it using parentheses (). Example: my_tuple = (1, 2, 3) ๐งต #PythonMastery ๐ #CodeLikeAPro ๐งฌ#LearnPython ๐ #CodingJourney ๐
4
0
0
๐คฃ๐คฃ๐คฃ
0
1
0
๐ Embrace new challenges, ๐ Learn from every experience, ๐ช Grow stronger each day! Let's conquer the world together! ๐๐ซ #Motivation #learning #Success
0
0
1
4/ Example of List Operations: my_list = [1, 2, 3] my_list.append(4) # [1, 2, 3, 4] my_list.remove(2) # [1, 3, 4] length = len(my_list) # 3 subset = my_list[1:] # [3, 4]
0
0
1
3/ Common List Operations: Append: Add an item to the end of the list. Remove: Remove an item by its value. Len: Get the number of items in the list. Slicing: Get a subset of the list.
0
0
1
2/ Accessing Elements: You can access elements by their index. Lists are zero-indexed, so the first element is at index 0. Use square brackets to access elements.
0
0
1
1/ Creating a List: Create a list like this: my_list = [1, 2, 3, "Hello", "World"]
0
0
1
Dose 14 - ๐A list is an ordered collection of items. These items can be of any data type: numbers, strings, even other lists! Lists are defined using square brackets [].๐งต #Python #Lists #PythonBasics #Coding101 #LearnToCode #CodeWithPython
4
0
1