<jupyter_start><jupyter_text>List In Python<jupyter_code>#List in python are ordered and have a definite count
#list are a useful tool for preserving a sequence of data and furtheriterating over it.
#list in python can be created by just placing the sequence inside the square bracket[].
list = ['Operating system', 'artificial Intelligence',1990,2001]
list<jupyter_output><empty_output><jupyter_text>Default Function<jupyter_code>list.append('Python') #append(): Used for appending and adding elements to list.
                      # it is used to add elements to the last position of list.
print(list)
list.insert(2,2000) #insert(): Insert an element at specified position
print(list)
list1 =[5,6,8]
list2 =[2,9,8,4]

# Add list2 to list1
list1.extend(list2)
print(list1)
#Add list1 to list2 now
list2.extend(list1)
print(list2)
list =[1,2,5,6,2,4,3,5,3,5]
print(list.index(2))
list.remove(5) # remove(): Element to be deleted is mentioned using list name and element.
print(list)<jupyter_output>[1, 2, 6, 2, 4, 3, 5, 3, 5]<jupyter_text>Dict -(Dictionary)<jupyter_code>#Dictionary in python is an unordered collection of data values,used to store
#data values like a map,which unlike other Dta Types that hold only single value as n element
#Dictionary holds key: value pair
# Dictionary i python can be created by{}
dit ={'A' : 'japan', 'B': 'India'}
print(dit)
print(dit.items())
print(dit.keys())
print(dit.keys())
dict.fromkeys(dit)
dit.update(A ='Man', B ='Woman')
print(dit)
print(dit.clear())
dit<jupyter_output><empty_output><jupyter_text>Set (Default function)<jupyter_code># A set is a data structure consisting(collection) of Unordered,Unique& Unindexed elements.
# When to use Sets in python? * the order of data does not matter.
#Unique data elements are needed
a= {1,2.5,6,'aaa','abc',8,5}
b =set([1,5,3,'abc',25]) # Set constructor method
print(a)
print(b)
c=set()  #  create Empty set
print(c)
len(a)
for x in a:
    print(x)
c.add(3)
c
c.update([2,'abc',3])
c
a.remove(2.5)
a
b.discard(5)
b
a.pop()
a
a
a|b   #PIPELINE METHOD FOR FINDING UNION OF A&B
a.union(b)
print(a|b|c)
print(a.union(b,c))
a&b
a.intersection(b,c)
a-b
b-a
a.difference(c)
a.difference(b,c)<jupyter_output><empty_output><jupyter_text>Tuple<jupyter_code># A tuple is an immutable sequence type
#Tuples are ordered immutable collection of objects
tup =('Shreyansh','@','Accenture.in')
tup
tup.count('@')
tup.index("Accenture.in")<jupyter_output><empty_output><jupyter_text>String<jupyter_code># Strings are sequence of characters enclosed within single quotes(''),double quotes("") or triple quotes
str = " Hello my name is <NAME>"
str
str[0]
str[-1]
len(str)
str.lower()
str.upper()
str.replace('a','b')
str.count('hello')
str.find("2")
str.rfind("l")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14296028880866427, 'fraction_numerical': 0.02635379061371841, 'mean_word_length': 6.015189873417722, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, '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': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '384215', 'license': 'Apache-2.0', 'n_tokens_mistral': 1052, 'n_tokens_neox': 1014, 'n_words': 307, 'path': 'python Day 2- Assignment.ipynb', 'repo_name': 'shreyanshdream/Python-Essential-program', 'size': '2779'}