<jupyter_start><jupyter_text>Data structure:<jupyter_code>A=[] # To create empty list
type(A)
A=[1,2.0,3,4.0,5,6.0,7,8.0] # Create a list with characters
A<jupyter_output><empty_output><jupyter_text>- Indexing the characters in the list A<jupyter_code>A[0],A[-1],A[2]
len(A) # To find the length of list A
A.append(10) # To add the characters in the list A
A
A.append(0.01)
A
sum(A)# To find the sum of all the characters in the list A
max(A), min(A) #Find the maximum and minimum character's value in the list A
B=[10,20,30,40,50,60.01,"Suresh",True, False]# Create the new list B consists of integer, float, string and Boolean 
B
type(B[-1]), type(B[0]),type(B[-3]),type(B[-4]) # To find the type of characters in the list B
C=[[1,2],[1.0,2.0]] #To create the list inside the list
C
'''Indexing the list and its characters inside the sublist. Type of characters inside the list and sublist.'''
C[0][1], C[1][0],type(C[1][0]),type(C[1]) 
C1=[10,20,30,40,50,60]; C2=[10,15,20,25,30,35,40,45,50,55,60]
C1+C2 # To add the characters of the lists. (Simply accumulated the characters in a list). 
set(C1+C2)# Also accumulated the characters in a list but it avoids the reapeated characters.
C1.insert(6,70)# To add the characters in a desired position
C1
'''To add the string in a desired position'''
C1.insert(1,"Basnet")
print(C1)
C1.remove("Basnet")# To remove the desired character from the list C1.
C1
C1.remove(70)
C1
C1.pop(1)# To remove character from the desired index.
C1
F2=[70,75,80, 90,85,10,15,20,25,30,35,40,45,50,55,60]# Angain create new list
F2
F2.sort()# To arrange the characters in index increasing order
F2
F2.reverse()# To arrange the characters in index decreasing order
F2<jupyter_output><empty_output><jupyter_text>- Another way to create the list (list Comprehension)<jupyter_code>D=[i for i in range(20)]# Excluding 20 and inclusion 0
print(D)
D=[i for i in range(20) if i%2==1] # List of characters divisible by 3.
print(D)
F=[i for i in range(21) if i%5==0] # List of characters divisible by 5.
print(F)
import random as random # To select a random integer
random.randint(1,10)
import random as random
Y=[random.randint(1,5) for i in range(20)]# To make a list of random integer
print(Y)
len(Y)
import random as random
Z=[random.randint(1,20) for i in range(10)]
print(Z)
import collections as collection
E=collection.Counter(Y) # To count the frequency of character.
print(E)<jupyter_output>Counter({4: 5, 1: 5, 2: 5, 5: 3, 3: 2})<jupyter_text>- Count of character(string) in the list.<jupyter_code>E1=[random.choice(['S','U','R','E','S','H']) for j in range(50)]
print(E1)
len(E1),type(E1[-1])
E1.count('S'),E1.count('H') # Count the particular string
import numpy as np
S = np.arange(0,np.pi,0.14)
#print(S)
import numpy as np
a=2;
c=5;
S = np.arange(0,np.pi,0.14)
U = {"sine": [np.sin(j) for j in S],\
     "function":[(a*i*i+c) for i in S]}
#print(S)
#print(U)
import pandas as pd # To arrange data in tabular form (Manipulation of data points) 
DF= pd.DataFrame(U)
#print(DF)
%matplotlib inline
DF.plot()
DF.to_csv('Datapoints.csv')# To save the obtained data points<jupyter_output><empty_output><jupyter_text>Tuples A tuple is a collection of characters and the characters are immutable. They are just like lists, but the charatcers in the tuples cannot be changed unlike the lists. For tuples, we have to use ( ) while for the list [ ].<jupyter_code>U=(1,2.0,3.5,4,5) # Example of tuple
print(U)
type(U)
U[-1],U[0] # To assign the index in tuple
S=[(10,11),(12,13),"SURESH",True,False]# To create the list of tuples
print(S)
type(S[0][1]),S[2],S[-1],type(S[-1])<jupyter_output><empty_output><jupyter_text>Dictionary  Python disctionary is defined the arangement of data into two characters Keys (must be immutable characters, string, tuples) and Values (can be any type).<jupyter_code>D = {"Vehicles":'Bus',
     "two wheelers":'bike',
     "Scooter":10,
     "Electric scooter":25,} #Example of dictionary form.<jupyter_output><empty_output><jupyter_text>- Here Vehicles, two wheelers, Scooter, Electric Scooter are keys and Bus, bike, 10 and 25 are the values.<jupyter_code>D.keys()
D.values()
D["Vehicles"],D["Scooter"] # Indexing the values of dictionary.
D.update({"Bicycle":10})
print(D)
list(D) # To list the keys of dictionary
list(D.keys()) # Another way to list the keys of dictionary
list(D.values()) # To make the list of values of dictionary<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14599366229062924, 'fraction_numerical': 0.05319148936170213, 'mean_word_length': 5.595522388059702, 'pattern_counts': {'":': 7, '<': 28, '<?xml version=': 0, '>': 28, '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': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '665031', 'license': 'MIT', 'n_tokens_mistral': 1743, 'n_tokens_neox': 1634, 'n_words': 548, 'path': 'DataStructurePractice.ipynb', 'repo_name': 'pmstha/Data-structure-with-description', 'size': '4418'}