<jupyter_start><jupyter_text>List functions<jupyter_code>lst = [20,10,40,50,30]
lst.append(60) # to appned an item in the list
print(lst)
print(len(lst)) # to display length of the list
lst.reverse() # to reverse the list
print(lst)
lst.sort() # to sort the list
print(lst)
print(lst.pop()) # removes and returns the last element of the list
print(max(lst))  #diaplay the maximum element of list
lst.remove(40) # remove the element from list
print(lst)<jupyter_output>[20, 10, 40, 50, 30, 60]
6
[60, 30, 50, 40, 10, 20]
[10, 20, 30, 40, 50, 60]
60
50
[10, 20, 30, 50]<jupyter_text>Dictinary and its functions<jupyter_code>capitals = {"India" : "Delhi" , "France"  : "Paris" , "Japan" : "Tokyo"}
print(capitals.get("India")) # get the value of key specified by us
print(len(capitals)) # returns the length of dictionary
print(capitals.items()) # returns a list of tuple . with each tuple containing ne key and the corresponding value
print(capitals.keys()) # return a list containing keys of dictionary
print(capitals.values()) # returns a list of values of dictionary<jupyter_output>Delhi
3
dict_items([('India', 'Delhi'), ('France', 'Paris'), ('Japan', 'Tokyo')])
dict_keys(['India', 'France', 'Japan'])
dict_values(['Delhi', 'Paris', 'Tokyo'])<jupyter_text>Sets and its functions<jupyter_code>s1 = {1 ,3 ,6 ,8 ,9}
s1.add(13)  # add new element in set
print(s1)
s1.update([15,18])  # adds multiple items from a list or tuple
print(s1)
s2 = s1.copy() # creates a copy of set object
print(s2)
s1.discard(8)  # returns set after removing the item no change if the item is not present in the set
print(s1)
s1.remove(6) # returns set after removing the item else returns error  if the item is not present in the set
print(s1)
s1.clear() # removes all the content of set
print(s1)<jupyter_output>{1, 3, 6, 8, 9, 13}
{1, 3, 6, 8, 9, 13, 15, 18}
{1, 3, 6, 8, 9, 13, 15, 18}
{1, 3, 6, 9, 13, 15, 18}
{1, 3, 9, 13, 15, 18}
set()<jupyter_text>Tuples and its functions<jupyter_code>T = (1,2,3,4,5,6,2,3,4,2,5)
print(T.count(2)) #Returns the number of times a specified value occurs in a tuple
print(T.index(3)) #method finds the first occurrence of the specified value<jupyter_output>3
2<jupyter_text>String and its default methods<jupyter_code>str = "hello I am Learning Python Essentials from lets upgrade"
print(str.upper()) #converts the string to upper case
print(str.lower())  #converts the string to lower case
print(str.find("am")) #Searches the string for a specified substring and returns the position of where it was found
print(str.count("a")) #Returns the number of times a specified substring occurs in a string
print(str.isalpha())   #Returns True if all characters in the string are in the alphabet
print(str.isupper()) #Returns True if all characters in the string are upper case
print(str.islower()) #Returns True if all characters in the string are lower case<jupyter_output>HELLO I AM LEARNING PYTHON ESSENTIALS FROM LETS UPGRADE
hello i am learning python essentials from lets upgrade
8
4
False
False
False
{'fraction_non_alphanumeric': 0.1230106100795756, 'fraction_numerical': 0.05172413793103448, 'mean_word_length': 5.40552016985138, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '558688', 'license': 'Apache-2.0', 'n_tokens_mistral': 1149, 'n_tokens_neox': 1029, 'n_words': 408, 'path': 'day2.ipynb', 'repo_name': 'prashijain/Letsupgrade-python', 'size': '3016'}