<jupyter_start><jupyter_text>list and its deafult functions<jupyter_code>extracting individual elements
l1 = [1,"a",2,"b",3,"c"]
l1[1]
l1 = [1,"a",2,"b",3,"c"]
l1[2:5]
modifying a list
l1 = [1,"a",2,"b",3,"c"]
l1[0] = 100
print(l1)
popping the last element
l1 = [1,"a",2,"b",3,"c"]
l1.pop()
l1
appending a new element
l1 = [1,"a",2,"b",3,"c"]
l1.append("sparta")
l1
reversing elements of a list
l1 = [1,"a",2,"b",3,"c"]
l1.reverse()
l1
inserting element at a speccified index
l1 = [1,"a",2,"b",3,"c"]
l1.insert(1,"sparta")
l1
sorting a list
l1 = ["mango","banana","guava","apple"]
l1.sort()
l1
concatenating list
l1 = [1,2,3]
l2 = ["a","b","c"]
l1+l2
repeating list
l1 = [1,"a",2,"b",3,"c"]
l1*3<jupyter_output><empty_output><jupyter_text>Dictionary and its deafult functions<jupyter_code>extracting keys
fruit = {"Apple":10,"Orange":20,"Banana":30,"Guava":40}
fruit.keys()
extracting values
fruit = {"Apple":10,"Orange":20,"Banana":30,"Guava":40}
fruit.values()
adding a new element
fruit = {"Apple":10,"Orange":20,"Banana":30,"Guava":40}
fruit["Mango"] = 50
fruit
changing an existing element
fruit = {"Apple":10,"Orange":20,"Banana":30,"Guava":40}
fruit["Apple"] = 1001
fruit
popping an element
fruit = {"Apple":10,"Orange":20,"Banana":30,"Guava":40}
fruit.pop("Orange")
fruit<jupyter_output><empty_output><jupyter_text>Sets and its default functions<jupyter_code>update one dictionarys element with another
s1 = {1,"a",True,2,"b",False}
s1.add("Hello")
s1
updating multiple elements
s1 = {1,"a",True,2,"b",False}
s1.update([10,20,30])
s1
removing an element
s1 = {1,"a",True,2,"b",False}
s1.remove("b")
s1
union of two sets
s1 = {1,2,3}
s2 = {"a","b","c"}
s1.union(s2)
intersection of two sets
s1 = {1,2,3,4,5,6}
s2 = {5,6,7,8,9}
s1.intersection(s2)<jupyter_output><empty_output><jupyter_text>Tuple and its default functions<jupyter_code>finding lenth of a tuple
tup1 = (1,"a",True,2,"b",False)
len(tup1)
concatenating tuple
tup1 = (1,2,3)
tup2 = (4,5,6)
tup1+tup2
repeating tuple elements
tup1 = (1,2,3)
tup1*5
repeating and concatenating
tup1 = ('sparta',300)
tup2 = (4,5,6)
tup1*3+tup2
minimum value
tup1 = (1,2,3,4,5,6)
min(tup1)
maximum value
tup1 = (1,2,3,4,5,6,7,8,9)
max(tup1)<jupyter_output><empty_output><jupyter_text>strings and its default functions<jupyter_code>extracting individual character
my_string = "<NAME>"
my_string[0]
for last character extracting
my_string = "<NAME>"
my_string[-1]
finding length of string
my_string = "<NAME>"
len(my_string)
converting string to lower
my_string = "<NAME>"
my_string.lower()
converting string to upper
my_string = "My Name Is Naveen"
my_string.upper()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.19674612183125237, 'fraction_numerical': 0.07756337495270525, 'mean_word_length': 7.96271186440678, 'pattern_counts': {'":': 20, '<': 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': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '46935', 'license': 'Apache-2.0', 'n_tokens_mistral': 1224, 'n_tokens_neox': 1154, 'n_words': 240, 'path': 'Assignment day2.ipynb', 'repo_name': 'amnavin/Letsupgrade-Python', 'size': '2687'}