<jupyter_start><jupyter_text>Tuples<jupyter_code># Tuples
# Creating an empty Tuple
Tuple1 = ()
print("Initial empty Tuple: ")
print(Tuple1)
 
# Creating a Tuple
# with the use of string
Tuple1 = ('Chilla', 'For')
print("\nTuple with the use of String: ")
print(Tuple1)
 
# Creating a Tuple with
# the use of list
list1 = [1, 2, 4, 5, 6]
print("\nTuple using List: ")
print(tuple(list1))
 
# Creating a Tuple
# with the use of built-in function
Tuple1 = tuple('Chilla')
print("\nTuple with the use of function: ")
print(Tuple1)

# Accessing Tuple
# with Indexing
Tuple1 = tuple("Chilla")
print("\nFirst element of Tuple: ")
print(Tuple1[0])
 
 
# Tuple unpacking
Tuple1 = ("Chilla", "For", "Python")
 
# This line unpack
# values of Tuple1
a, b, c = Tuple1
print("\nValues after unpacking: ")
print(a)
print(b)
print(c)
# Concatenation of tuples
Tuple1 = (0, 1, 2, 3)
Tuple2 = ('Chilla', 'in', 'Data science')
 
Tuple3 = Tuple1 + Tuple2
 
# Printing first Tuple
print("Tuple 1: ")
print(Tuple1)
 
# Printing Second Tuple
print("\nTuple2: ")
print(Tuple2)
 
# Printing Final Tuple
print("\nTuples after Concatenation: ")
print(Tuple3)
# Slicing of a Tuple
 
# Slicing of a Tuple
# with Numbers
Tuple1 = tuple('Chila in Data Science')
 
# Removing First element
print("Removal of First Element: ")
print(Tuple1[1:])
 
# Reversing the Tuple
print("\nTuple after sequence of Element is reversed: ")
print(Tuple1[::-1])
 
# Printing elements of a Range
print("\nPrinting elements between Range 4-9: ")
print(Tuple1[4:9])
# Deleting a Tuple
 
Tuple1 = (0, 1, 2, 3, 4)
del Tuple1
 
print(Tuple1)<jupyter_output><empty_output><jupyter_text>List<jupyter_code># Python program to demonstrate
# Creation of List
 
# Creating a List
List = []
print("Blank List: ")
print(List)
 
# Creating a List of numbers
List = [10, 20, 14]
print("\nList of numbers: ")
print(List)
 
# Creating a List of strings and accessing
# using index
List = ["Chilla", "For", "Data Science"]
print("\nList Items: ")
print(List[0])
print(List[2])
 
# Creating a Multi-Dimensional List
# (By Nesting a list inside a List)
List = [['Chilla', 'For'], ['Data Science']]
print("\nMulti-Dimensional List: ")
print(List)
# Creating a List with
# the use of Numbers
# (Having duplicate values)
List = [1, 2, 4, 4, 3, 3, 3, 6, 5]
print("\nList with the use of Numbers: ")
print(List)
 
# Creating a List with
# mixed type of values
# (Having numbers and strings)
List = [1, 2, 'Python', 4, 'For', 6, 'Begginer']
print("\nList with the use of Mixed Values: ")
print(List)
# Creating a List
List1 = []
print(len(List1))
 
# Creating a List of numbers
List2 = [10, 20, 14]
print(len(List2))

# Python program to demonstrate
# Addition of elements in a List
 
# Creating a List
List = []
print("Initial blank List: ")
print(List)
 
# Addition of Elements
# in the List
List.append(1)
List.append(2)
List.append(4)
print("\nList after Addition of Three elements: ")
print(List)
 
# Adding elements to the List
# using Iterator
for i in range(1, 4):
    List.append(i)
print("\nList after Addition of elements from 1-3: ")
print(List)
 
# Adding Tuples to the List
List.append((5, 6))
print("\nList after Addition of a Tuple: ")
print(List)
 
# Addition of List to a List
List2 = ['For', 'Python']
List.append(List2)
print("\nList after Addition of a List: ")
print(List)

# Python program to demonstrate
# accessing of element from list
 
# Creating a List with
# the use of multiple values
List = ["Python", "For", "World"]
 
# accessing a element from the
# list using index number
print("Accessing a element from the list")
print(List[0])
print(List[2])
 
# Creating a Multi-Dimensional List
# (By Nesting a list inside a List)
List = [['Python', 'For'], ['DS']]
 
# accessing an element from the
# Multi-Dimensional List using
# index number
print("Accessing a element from a Multi-Dimensional list")
print(List[0][1])
print(List[1][0])<jupyter_output>Accessing a element from the list
Geeks
Geeks
Accessing a element from a Multi-Dimensional list
For
Geeks<jupyter_text>Dictionary<jupyter_code># Creating a Dictionary
# with Integer Keys
Dict = {1: 'Python', 2: 'For', 3: 'All'}
print("\nDictionary with the use of Integer Keys: ")
print(Dict)
 
# Creating a Dictionary
# with Mixed keys
Dict = {'Name': 'Python', 1: [1, 2, 3, 4]}
print("\nDictionary with the use of Mixed Keys: ")
print(Dict)
# Creating an empty Dictionary
Dict = {}
print("Empty Dictionary: ")
print(Dict)
 
# Creating a Dictionary
# with dict() method
Dict = dict({1: 'Python', 2: 'For', 3:'all'})
print("\nDictionary with the use of dict(): ")
print(Dict)
 
# Creating a Dictionary
# with each item as a Pair
Dict = dict([(1, 'Python'), (2, 'For')])
print("\nDictionary with each item as a pair: ")
print(Dict)

# Creating a Nested Dictionary
# as shown in the below image
Dict = {1: 'Python', 2: 'For',
        3:{'A' : 'Welcome', 'B' : 'To', 'C' : 'Python'}}
 
print(Dict)
# Creating an empty Dictionary
Dict = {}
print("Empty Dictionary: ")
print(Dict)
 
# Adding elements one at a time
Dict[0] = 'Python'
Dict[2] = 'For'
Dict[3] = 1
print("\nDictionary after adding 3 elements: ")
print(Dict)
 
# Adding set of values
# to a single Key
Dict['Value_set'] = 2, 3, 4
print("\nDictionary after adding 3 elements: ")
print(Dict)
 
# Updating existing Key's Value
Dict[2] = 'Welcome'
print("\nUpdated key value: ")
print(Dict)
 
# Adding Nested Key value to Dictionary
Dict[5] = {'Nested' :{'1' : 'Begginer', '2' : 'Python'}}
print("\nAdding a Nested Key: ")
print(Dict)

# Python program to demonstrate 
# accessing a element from a Dictionary
 
# Creating a Dictionary
Dict = {"Course": 'Python', 'name': 'For', 3: 'Students'}
 
# accessing a element using key
print("Accessing a element using key:")
print(Dict['name'])
 
# accessing a element using key
print("Accessing a element using key:")
print(Dict['Course'])
# Creating a Dictionary
Dict = {1: 'Python', 'name': 'For', 3: 'Name'}
 
 
# Deleting entire Dictionary
Dict.clear()
print("\nDeleting Entire Dictionary: ")
print(Dict)<jupyter_output>Deleting Entire Dictionary: 
{}<jupyter_text>Sets<jupyter_code># Python program to demonstrate
# Creation of Set in Python
 
# Creating a Set
set1 = set()
print("Initial blank Set: ")
print(set1)
 
# Creating a Set with
# the use of a String
set1 = set("codetolive")
print("\nSet with the use of String: ")
print(set1)
 
# Creating a Set with
# the use of Constructor
# (Using object to Store String)
String = 'pythontobreath'
set1 = set(String)
print("\nSet with the use of an Object: " )
print(set1)
 
# Creating a Set with
# the use of a List
set1 = set(["python", "For", "students"])
print("\nSet with the use of List: ")
print(set1)
# Creating a Set with
# a List of Numbers
# (Having duplicate values)
set1 = set([1, 2, 4, 4, 3, 3, 3, 6, 5])
print("\nSet with the use of Numbers: ")
print(set1)
 
# Creating a Set with
# a mixed type of values
# (Having numbers and strings)
set1 = set([1, 2, 'python', 4, 'For', 6, 'Students'])
print("\nSet with the use of Mixed Values")
print(set1)
# Python program to demonstrate
# Addition of elements in a Set
 
# Creating a Set
set1 = set()
print("Initial blank Set: ")
print(set1)
 
# Adding element and tuple to the Set
set1.add(8)
set1.add(9)
set1.add((6,7))
print("\nSet after Addition of Three elements: ")
print(set1)
 
# Adding elements to the Set
# using Iterator
for i in range(1, 6):
    set1.add(i)
print("\nSet after Addition of elements from 1-5: ")
print(set1)
# Addition of elements in a Set
 
# Addition of elements to the Set
# using Update function
set1 = set([ 4, 5, (6, 7)])
set1.update([10, 11])
print("\nSet after Addition of elements using Update: ")
print(set1)
# Accessing of elements in a set
 
# Creating a set
set1 = set(["Python", "For", "Students"])
print("\nInitial set")
print(set1)
 
# Accessing element using
# for loop
print("\nElements of set: ")
for i in set1:
    print(i, end=" ")
 
# Checking the element
# using in keyword
print("Python" in set1)

# Deletion of elements in a Set
 
# Creating a Set
set1 = set([1, 2, 3, 4, 5, 6,
            7, 8, 9, 10, 11, 12])
print("Initial Set: ")
print(set1)
 
# Removing element from the
# Set using the pop() method
set1.pop()
print("\nSet after popping an element: ")
print(set1)
# Deletion of elements in a Set
 
# Creating a Set
set1 = set([1, 2, 3, 4, 5, 6,
            7, 8, 9, 10, 11, 12])
print("Initial Set: ")
print(set1)
 
# Removing elements from Set
# using Remove() method
set1.remove(5)
set1.remove(6)
print("\nSet after Removal of two elements: ")
print(set1)
 
# Removing elements from Set
# using Discard() method
set1.discard(8)
set1.discard(9)
print("\nSet after Discarding two elements: ")
print(set1)
 
# Removing elements from Set
# using iterator method
for i in range(1, 5):
    set1.remove(i)
print("\nSet after Removing a range of elements: ")
print(set1)
#Creating a set
set1 = set([1,2,3,4,5])
print("\n Initial set: ")
print(set1)
 
 
# Removing all the elements from
# Set using clear() method
set1.clear()
print("\nSet after clearing all the elements: ")
print(set1)<jupyter_output>Initial set: 
{1, 2, 3, 4, 5}

Set after clearing all the elements: 
set()
{'fraction_non_alphanumeric': 0.14012251148545177, 'fraction_numerical': 0.027455698971778603, 'mean_word_length': 4.4683014354066986, 'pattern_counts': {'":': 1, '<': 14, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '402368', 'license': 'Apache-2.0', 'n_tokens_mistral': 3391, 'n_tokens_neox': 3096, 'n_words': 1169, 'path': 'Python_programming/15_data_structures.ipynb', 'repo_name': 'Aliktk/Python_Chilla', 'size': '9142'}