Program1:checkwhetherthenumberisbelongstoFibonacciseriesornot PARTA n=int(input("Enterthenumber:")) c=0 a=1 b=1 ifn==0or n==1: print("YesthenumberbelongstoFibonacciseries") else: whilec0): sum+=num num-=1 print("Thesumis:",sum) ========OUTPUT======== Enteranumber:10 The sum is: 55 Program4:DisplayMultiplicationtable num=int(input("Displaymultiplicationtableof?")) # Iterate 10 times from i = 1 to 10 for i in range(1, 11): print(num,'x',i,'=',num*i) ===========OUTPUT======= Displaymultiplicationtableof?5 5 x 1 = 5 5x2= 10 5x3= 15 5x4= 20 5x5= 25 5x6= 30 5x7= 35 5x8= 40 5x9= 45 5x10= 50 Program5:Tocheckifanumberisprimeornot num=int(input('Pleaseenteranumber:')) i = 2 flag = 0 whileiarray[j]: min = j ifmin !=i: temp = array[i] array[i]=array[min] array[min] = temp print("TheSortedarrayinascendingorder:",end='\n') for i in range(n): print(array[i]) =========OUTPUT======== Enterthelimit 5 EntertheElement:12 Enter the Element: 2 Enter the Element: 5 EntertheElement:23 Enter the Element: 1 TheSortedarrayinascendingorder: 1 2 5 12 23 Program10:Toimplementstack #initialemptystack stack = [] #append()functiontopush # element in the stack stack.append('1') stack.append('2') stack.append('3') print(stack) #pop()functiontopop # element from stack in # LIFO order print('\nElementspopedfrommy_stack:') print(stack.pop()) print(stack.pop()) print(stack.pop()) #print(stack.pop()) print('\nmy_stackafterelementsarepoped:') print(stack) ========OUTPUT======== ['1', '2', '3'] Elementspopedfrommy_stack: 3 2 1 my_stackafterelementsarepoped: [ ] Program11:ReadandWriteintoafile #open a file for writing file=open("E:\klcF.txt","w") #write some text to the file file.write("WelcometoBCADepartment\n") L=['ThisisBCACollege\n','PlaceisNidasoshi\n','Fourthsemester\n'] file.writelines(L) #closethefile file.close() #open the file for reading file=open("E:\klcF.txt","r") #readthecontentsofthefileintoastringvariable file_cont=file.read() #printthecontentsofthefile print(file_cont) ===========OUTPUT========== E:\klcF.txt WelcometoBCADepartment This is BCA College PlaceisNidasoshi Fourth semester PARTB #Program1:Demonstrateusageofbasicregularexpression importre # Search String str="Theraininspain" x=re.findall("ai",str) print("Searchofstring'ai':",x) x=re.search("\s",str) print("Thefirstwhite-spacecharacterislocatedinposition:",x.start()) x=re.split("\s",str,1) print("Splitthestringintheoccuranceoffirstwhite-space:",x) x=re.sub("\s","9",str) print("Eachwhite-spaceisreplacedwith9digit:",x) print(" ") # Metacharacters x=re.findall("[a-g]",str) print("Thelettersinbetweenatoginthestring:",x) x=re.findall("spain$",str) if(x): print("\n",str,":Yes,thisstringendswith'spain'word") else: print("\n No match ") x=re.findall("^The",str) if(x): print("\n",str,":Yes,thisstringstartswith'The'word") else: print("\nNomatch") str1="Theraininspainfallsmainlyintheplain" x=re.findall("ai*",str1) print("\nAllaimatchingcharacters:",x) if(x): print("Yes,thereisatleastonematch") else: print("Nomatch") x=re.findall("all{1}",str1) print("\nThestringwhichcontains'all':",x) if(x): print("Yes,thereisatleastonematch") else: print("Nomatch") str2="Thatwillbe59dollars" x=re.findall("\d",str2) print("\nDigitsinthestring:",x) x=re.findall("do...rs",str2) print("\nDotmetacharactermatchesanycharacter:",x) ============OUTPUT========== Searchofstring'ai':['ai','ai'] Thefirstwhite-spacecharacterislocatedinposition:3 Splitthestringintheoccuranceoffirstwhite-space:['The','raininspain'] Each white-space is replaced with 9 digit:The9rain9in9spain ------------------------------------------------------------------------------ The letters in between a to g in the string: ['e', 'a', 'a'] Theraininspain:Yes,thisstringendswith'spain'word Theraininspain:Yes,this string starts with'The' word All ai matching characters: ['ai', 'ai', 'a', 'ai', 'ai'] Yes,thereisatleastonematch Thestringwhichcontains'all':['all'] Yes, there is atleast one match Digitsinthestring:['5','9'] Dotmetacharactermatchesanycharacter:['dollars'] Program2:Demonstrateuseofadvancedregularexpressionsfor-data validation. #importingrelibrary import re p=input("Enteryourpassword:") x=True whilex: if(len(p)<6orlen(p)>20): break elifnotre.search("[a-z]",p): break elifnotre.search("[A-Z]",p): break elifnotre.search("[0-9]",p): break elifnotre.search("[$#@]",p): break elifre.search("\s",p): break else: print("ValidPassword") x=False break if x: print("InvalidPassword") ===========OUTPUT======== Enteryourpassword:Kavita123@# Valid Password Enteryourpassword:bcacollege Invalid Password Program3:DemonstrateuseofList print("PROGRAMFORBUILT-INMETHODSOFLIST\n"); demonstrate List numbers=[1,2,13,40,5] print(numbers) sum_of_numbers=sum(numbers) print("Sum=",sum_of_numbers) max_number=max(numbers) print("Max=",max_number) min_number=min(numbers) print("Min=",min_number) numbers.sort() print("sortednumbersinascending",numbers) numbers.reverse() print("sortednumbersindescending",numbers) numbers.append(6) print("Updatednumbers",numbers) numbers.remove(13) print("Removed",numbers) numbers.clear() print("Listafterclear",numbers) ==========OUTPUT======== PROGRAMFORBUILT-INMETHODSOFLIST [1,2,13,40,5] Sum=61 Max=40 Min=1 sortednumbersinascending[1,2,5,13,40] sortednumbersindescending[40,13,5,2,1] Updatednumbers[40,13,5,2,1,6] Removed[40,5,2,1,6] List after clear [] Program4:DemonstrateuseofDictionaries #deomstrate Dictionary person={"name":"Amit","age":"21","city":"Bangaluru","occupation":"student"} #accessvaluesinthedictionary print(person["name"]) print(person["age"]) print(person["city"]) print(person["occupation"]) #modify values in the dictionary person["age"]=25 person["occupation"]="Engineer" print(person) #addanewkey-valuepairtothedictionary person["country"]="India" print(person) #removeakey-valuepairfromdictonary del person["city"] print(person) #check if key-value exist in the dictionary if "occupation" in person: print("occupation:",person["occupation"]) ============OUTPUT========== Amit 21 Bangaluru student {'name':'Amit','age':25,'city':'Bangaluru','occupation':'Engineer'} {'name':'Amit','age':25,'city':'Bangaluru','occupation':'Engineer', 'country': 'India'} {'name':'Amit','age':25,'occupation':'Engineer','country':'India'} occupation: Engineer Program5:CreateSQLiteDatabaseandperformoperationson tables importsqlite3 #createaconnectiontoaSqlitedatabase conn=sqlite3.connect('test.db') #createacursorobject cursor=conn.cursor() #createatable cursor.execute("createtableemp2(idinteger,nametect)") #insert a record into the tables cursor.execute("insert into emp2(id,name) values(101,'ravi')") cursor.execute("insert into emp2(id,name) values(102,'raj')") cursor.execute("insertintoemp2(id,name)values(103,'ramesh')") print("\nDisplaying the emp2 table") cursor.execute("select*fromemp2") rows=cursor.fetchall() forrowinrows: print(row) print("\nafterupdateanddeletetherecordsinthetable") # update records in the table cursor.execute("updateemp2setname='Akash'whereid=101") #delete a record from the table cursor.execute("deletefromemp2whereid=103") print("Displaying the emp2 table") cursor.execute("select *from emp2") rows=cursor.fetchall() forrowinrows: print(row) #drop the table print("\nTableisdroped...") cursor.execute("droptableemp2") #commit the transaction conn.commit() #closethecursorandtheconnections cursor.close() conn.close() =========OUTPUT======= Displayingtheemp2table (101, 'ravi') (102,'raj') (103,'ramesh') afterupdateanddeletetherecordsinthetable Displaying the emp2 table (101,'Akash') (102,'raj') Tableisdroped... Program6:CreateaGUIusingTkintermodule importtkinterastk from tkinter import messagebox #functiontohandlebuttonclickevent def show_message(): messagebox.showinfo("Hello","welcometotheGUI") #create the main window window=tk.Tk() window.title("My GUI") window.geometry("300x200") #create label widget label=tk.Label(window,text="Hello,world") label.pack() #createabuttonwidget button=tk.Button(window,text="click me",command=show_message) button.pack() #startthemaineventloop window.mainloop() =========OUTPUT========== Program7:Demonstrateexceptionsinpython try: num1=int(input("Enter the numerator:")) num2=int(input("Enterthedenominator:")) result=num1/num2 print("Result:",result) except ValueError: print("Invalid input") exceptZeroDivisionError: print("Cannotdividebyzero") else: print("Noexceptionoccur") finally: print("Endofprogram") ===========OUTPUT========== Enterthenumerator:12.2 Invalid input Endof program Enter the numerator:10 Enterthedinominator:0 Cannot divide by zero End of program Program8:DrawingLinechartandBarchartusingMatplotlib importmatplotlib.pyplotasplt # Data x=[2,3,4,6,8] y=[2,3,4,6,8] #Plotthelinechart plt.subplot(121) plt.plot(x,y,color='tab:red') # Add labels and title plt.title('Line Chart') plt.xlabel('Xaxislabel') plt.ylabel('Yaxislabel') # Show the plot plt.subplot(122) plt.title('Bar Chart') plt.xlabel('Xaxislabel') plt.ylabel('Yaxislabel') plt.bar(x,y) plt.show() ==========OUTPUT======= Program9:DrawingHistogramchartandPiechartusingMatplotlib importmatplotlib.pyplotasplt import numpy as np #Generate some random data data=np.random.randint(0,100,100) #create histogram plt.subplot(121) plt.hist(data,bins=20) plt.title("Histogramofrandomdata") plt.xlabel("value") plt.ylabel("frequency") #sample data sizes=[30,25,20,15,10] labels=['A','B','C','D','E'] #create pie chart plt.subplot(122) plt.pie(sizes,labels=labels) plt.title("PIE CHART") plt.show() ==========OUTPUT========= Program10:performarithmeticoperationsontheNumpyarrays importnumpyasnp #Initializingourarray array1=np.arange(9,dtype=np.float64).reshape(3,3) #array1 = np.arange(9, dtype = np.float64) print('FirstArray:') print(array1) print('Secondarray:') array2=np.arange(11,20,dtype=np.float_).reshape(3,3) #array2 = np.arange(11,20, dtype = np.int_) print(array2)print('\nAddingtwoarrays:') print(np.add(array1,array2)) print('\nSubtracting two arrays:') print(np.subtract(array1,array2)) print('\nMultiplying two arrays:') print(np.multiply(array1,array2)) print('\nDividing two arrays:') print(np.divide(array1,array2)) =========OUTPUT======= FirstArray: Secondarray: [[0.1.2.] [[11.12.13.] [3.4. 5.] [14.15.16.] [6.7. 8.]] [17.18.19.]] Addingtwoarrays: [[11.13.15.] [17.19.21.] [23.25.27.]] Subtractingtwoarrays: [[-11.-11.-11.] [-11.-11.-11.] [-11.-11.-11.]] Multiplyingtwoarrays: [[0.12.26.] [42.60.80.] [102.126.152.]] Dividingtwoarrays: [[0. 0.083333330.15384615] [0.214285710.266666670.3125 ] [0.352941180.388888890.42105263]] Program11:CreatedataframefromExcelsheetusingPandasandperform operations on data frames importpandasaspd #ReaddatafromexcelsheetsinanExcelfile data=pd.read_excel('file.xlsx',sheet_name='kavita') print("\n**Displaying Data from DataFrames**\n") print(data) print("\n**OPERATIONS ON DATAFRAMES**\n") print("\n1.ViewthefirstfewrowsoftheDataFrame:") print(data.head()) print("\n2.NumberofrowsandcolumnsintheDataFrame:",end="") print(data.shape) print("\n3.Filtereddata(Agecolumn<25):") filtered_data =data[data['Age'] < 25] print(filtered_data) print("\n4.SortDataFramebasedon'Age'colinascendingorder:") sorted_data = data.sort_values(by='Age', ascending=True) print(sorted_data) print("\nProgramClosed...") =========OUTPUT========= **DisplayingDatafromDataFrames** name Age marks 0 kiran 23 70 1 savita 20 90 2 kavya 25 80 3 sagar 18 70 4 sumit 21 56 5 sanket 22 50 6 akash 24 70 7 ramesh 26 40 8 ravi 27 45 9 soumya 28 90 10shilpa 17 65 **OPERATIONSONDATAFRAMES** ViewthefirstfewrowsoftheDataFrame: nameAgemarks kiran 23 70 savita 20 90 kavya 25 80 sagar 18 70 sumit 21 56 NumberofrowsandcolumnsintheDataFrame:(11,3) Filtereddata(Agecolumn<25): nameAgemarks kiran 23 70 savita 20 90 sagar 18 70 sumit 21 56 sanket 22 50 akash 24 70 10shilpa 17 65 SortDataFramebasedon'Age'colinascendingorder: name Age marks 10 shilpa 17 65 3 sagar 18 70 1 savita 20 90 4 sumit 21 56 5 sanket 22 50 0 kiran 23 70 6 akash 24 70 2 kavya 25 80 7 ramesh 26 40 8 ravi 27 45Program1:checkwhetherthenumberisbelongstoFibonacciseriesornot PARTA n=int(input("Enterthenumber:")) c=0 a=1 b=1 ifn==0or n==1: print("YesthenumberbelongstoFibonacciseries") else: whilec0): sum+=num num-=1 print("Thesumis:",sum) ========OUTPUT======== Enteranumber:10 The sum is: 55 Program4:DisplayMultiplicationtable num=int(input("Displaymultiplicationtableof?")) # Iterate 10 times from i = 1 to 10 for i in range(1, 11): print(num,'x',i,'=',num*i) ===========OUTPUT======= Displaymultiplicationtableof?5 5 x 1 = 5 5x2= 10 5x3= 15 5x4= 20 5x5= 25 5x6= 30 5x7= 35 5x8= 40 5x9= 45 5x10= 50 Program5:Tocheckifanumberisprimeornot num=int(input('Pleaseenteranumber:')) i = 2 flag = 0 whileiarray[j]: min = j ifmin !=i: temp = array[i] array[i]=array[min] array[min] = temp print("TheSortedarrayinascendingorder:",end='\n') for i in range(n): print(array[i]) =========OUTPUT======== Enterthelimit 5 EntertheElement:12 Enter the Element: 2 Enter the Element: 5 EntertheElement:23 Enter the Element: 1 TheSortedarrayinascendingorder: 1 2 5 12 23 Program10:Toimplementstack #initialemptystack stack = [] #append()functiontopush # element in the stack stack.append('1') stack.append('2') stack.append('3') print(stack) #pop()functiontopop # element from stack in # LIFO order print('\nElementspopedfrommy_stack:') print(stack.pop()) print(stack.pop()) print(stack.pop()) #print(stack.pop()) print('\nmy_stackafterelementsarepoped:') print(stack) ========OUTPUT======== ['1', '2', '3'] Elementspopedfrommy_stack: 3 2 1 my_stackafterelementsarepoped: [ ] Program11:ReadandWriteintoafile #open a file for writing file=open("E:\klcF.txt","w") #write some text to the file file.write("WelcometoBCADepartment\n") L=['ThisisBCACollege\n','PlaceisNidasoshi\n','Fourthsemester\n'] file.writelines(L) #closethefile file.close() #open the file for reading file=open("E:\klcF.txt","r") #readthecontentsofthefileintoastringvariable file_cont=file.read() #printthecontentsofthefile print(file_cont) ===========OUTPUT========== E:\klcF.txt WelcometoBCADepartment This is BCA College PlaceisNidasoshi Fourth semester PARTB #Program1:Demonstrateusageofbasicregularexpression importre # Search String str="Theraininspain" x=re.findall("ai",str) print("Searchofstring'ai':",x) x=re.search("\s",str) print("Thefirstwhite-spacecharacterislocatedinposition:",x.start()) x=re.split("\s",str,1) print("Splitthestringintheoccuranceoffirstwhite-space:",x) x=re.sub("\s","9",str) print("Eachwhite-spaceisreplacedwith9digit:",x) print(" ") # Metacharacters x=re.findall("[a-g]",str) print("Thelettersinbetweenatoginthestring:",x) x=re.findall("spain$",str) if(x): print("\n",str,":Yes,thisstringendswith'spain'word") else: print("\n No match ") x=re.findall("^The",str) if(x): print("\n",str,":Yes,thisstringstartswith'The'word") else: print("\nNomatch") str1="Theraininspainfallsmainlyintheplain" x=re.findall("ai*",str1) print("\nAllaimatchingcharacters:",x) if(x): print("Yes,thereisatleastonematch") else: print("Nomatch") x=re.findall("all{1}",str1) print("\nThestringwhichcontains'all':",x) if(x): print("Yes,thereisatleastonematch") else: print("Nomatch") str2="Thatwillbe59dollars" x=re.findall("\d",str2) print("\nDigitsinthestring:",x) x=re.findall("do...rs",str2) print("\nDotmetacharactermatchesanycharacter:",x) ============OUTPUT========== Searchofstring'ai':['ai','ai'] Thefirstwhite-spacecharacterislocatedinposition:3 Splitthestringintheoccuranceoffirstwhite-space:['The','raininspain'] Each white-space is replaced with 9 digit:The9rain9in9spain ------------------------------------------------------------------------------ The letters in between a to g in the string: ['e', 'a', 'a'] Theraininspain:Yes,thisstringendswith'spain'word Theraininspain:Yes,this string starts with'The' word All ai matching characters: ['ai', 'ai', 'a', 'ai', 'ai'] Yes,thereisatleastonematch Thestringwhichcontains'all':['all'] Yes, there is atleast one match Digitsinthestring:['5','9'] Dotmetacharactermatchesanycharacter:['dollars'] Program2:Demonstrateuseofadvancedregularexpressionsfor-data validation. #importingrelibrary import re p=input("Enteryourpassword:") x=True whilex: if(len(p)<6orlen(p)>20): break elifnotre.search("[a-z]",p): break elifnotre.search("[A-Z]",p): break elifnotre.search("[0-9]",p): break elifnotre.search("[$#@]",p): break elifre.search("\s",p): break else: print("ValidPassword") x=False break if x: print("InvalidPassword") ===========OUTPUT======== Enteryourpassword:Kavita123@# Valid Password Enteryourpassword:bcacollege Invalid Password Program3:DemonstrateuseofList print("PROGRAMFORBUILT-INMETHODSOFLIST\n"); demonstrate List numbers=[1,2,13,40,5] print(numbers) sum_of_numbers=sum(numbers) print("Sum=",sum_of_numbers) max_number=max(numbers) print("Max=",max_number) min_number=min(numbers) print("Min=",min_number) numbers.sort() print("sortednumbersinascending",numbers) numbers.reverse() print("sortednumbersindescending",numbers) numbers.append(6) print("Updatednumbers",numbers) numbers.remove(13) print("Removed",numbers) numbers.clear() print("Listafterclear",numbers) ==========OUTPUT======== PROGRAMFORBUILT-INMETHODSOFLIST [1,2,13,40,5] Sum=61 Max=40 Min=1 sortednumbersinascending[1,2,5,13,40] sortednumbersindescending[40,13,5,2,1] Updatednumbers[40,13,5,2,1,6] Removed[40,5,2,1,6] List after clear [] Program4:DemonstrateuseofDictionaries #deomstrate Dictionary person={"name":"Amit","age":"21","city":"Bangaluru","occupation":"student"} #accessvaluesinthedictionary print(person["name"]) print(person["age"]) print(person["city"]) print(person["occupation"]) #modify values in the dictionary person["age"]=25 person["occupation"]="Engineer" print(person) #addanewkey-valuepairtothedictionary person["country"]="India" print(person) #removeakey-valuepairfromdictonary del person["city"] print(person) #check if key-value exist in the dictionary if "occupation" in person: print("occupation:",person["occupation"]) ============OUTPUT========== Amit 21 Bangaluru student {'name':'Amit','age':25,'city':'Bangaluru','occupation':'Engineer'} {'name':'Amit','age':25,'city':'Bangaluru','occupation':'Engineer', 'country': 'India'} {'name':'Amit','age':25,'occupation':'Engineer','country':'India'} occupation: Engineer Program5:CreateSQLiteDatabaseandperformoperationson tables importsqlite3 #createaconnectiontoaSqlitedatabase conn=sqlite3.connect('test.db') #createacursorobject cursor=conn.cursor() #createatable cursor.execute("createtableemp2(idinteger,nametect)") #insert a record into the tables cursor.execute("insert into emp2(id,name) values(101,'ravi')") cursor.execute("insert into emp2(id,name) values(102,'raj')") cursor.execute("insertintoemp2(id,name)values(103,'ramesh')") print("\nDisplaying the emp2 table") cursor.execute("select*fromemp2") rows=cursor.fetchall() forrowinrows: print(row) print("\nafterupdateanddeletetherecordsinthetable") # update records in the table cursor.execute("updateemp2setname='Akash'whereid=101") #delete a record from the table cursor.execute("deletefromemp2whereid=103") print("Displaying the emp2 table") cursor.execute("select *from emp2") rows=cursor.fetchall() forrowinrows: print(row) #drop the table print("\nTableisdroped...") cursor.execute("droptableemp2") #commit the transaction conn.commit() #closethecursorandtheconnections cursor.close() conn.close() =========OUTPUT======= Displayingtheemp2table (101, 'ravi') (102,'raj') (103,'ramesh') afterupdateanddeletetherecordsinthetable Displaying the emp2 table (101,'Akash') (102,'raj') Tableisdroped... Program6:CreateaGUIusingTkintermodule importtkinterastk from tkinter import messagebox #functiontohandlebuttonclickevent def show_message(): messagebox.showinfo("Hello","welcometotheGUI") #create the main window window=tk.Tk() window.title("My GUI") window.geometry("300x200") #create label widget label=tk.Label(window,text="Hello,world") label.pack() #createabuttonwidget button=tk.Button(window,text="click me",command=show_message) button.pack() #startthemaineventloop window.mainloop() =========OUTPUT========== Program7:Demonstrateexceptionsinpython try: num1=int(input("Enter the numerator:")) num2=int(input("Enterthedenominator:")) result=num1/num2 print("Result:",result) except ValueError: print("Invalid input") exceptZeroDivisionError: print("Cannotdividebyzero") else: print("Noexceptionoccur") finally: print("Endofprogram") ===========OUTPUT========== Enterthenumerator:12.2 Invalid input Endof program Enter the numerator:10 Enterthedinominator:0 Cannot divide by zero End of program Program8:DrawingLinechartandBarchartusingMatplotlib importmatplotlib.pyplotasplt # Data x=[2,3,4,6,8] y=[2,3,4,6,8] #Plotthelinechart plt.subplot(121) plt.plot(x,y,color='tab:red') # Add labels and title plt.title('Line Chart') plt.xlabel('Xaxislabel') plt.ylabel('Yaxislabel') # Show the plot plt.subplot(122) plt.title('Bar Chart') plt.xlabel('Xaxislabel') plt.ylabel('Yaxislabel') plt.bar(x,y) plt.show() ==========OUTPUT======= Program9:DrawingHistogramchartandPiechartusingMatplotlib importmatplotlib.pyplotasplt import numpy as np #Generate some random data data=np.random.randint(0,100,100) #create histogram plt.subplot(121) plt.hist(data,bins=20) plt.title("Histogramofrandomdata") plt.xlabel("value") plt.ylabel("frequency") #sample data sizes=[30,25,20,15,10] labels=['A','B','C','D','E'] #create pie chart plt.subplot(122) plt.pie(sizes,labels=labels) plt.title("PIE CHART") plt.show() ==========OUTPUT========= Program10:performarithmeticoperationsontheNumpyarrays importnumpyasnp #Initializingourarray array1=np.arange(9,dtype=np.float64).reshape(3,3) #array1 = np.arange(9, dtype = np.float64) print('FirstArray:') print(array1) print('Secondarray:') array2=np.arange(11,20,dtype=np.float_).reshape(3,3) #array2 = np.arange(11,20, dtype = np.int_) print(array2)print('\nAddingtwoarrays:') print(np.add(array1,array2)) print('\nSubtracting two arrays:') print(np.subtract(array1,array2)) print('\nMultiplying two arrays:') print(np.multiply(array1,array2)) print('\nDividing two arrays:') print(np.divide(array1,array2)) =========OUTPUT======= FirstArray: Secondarray: [[0.1.2.] [[11.12.13.] [3.4. 5.] [14.15.16.] [6.7. 8.]] [17.18.19.]] Addingtwoarrays: [[11.13.15.] [17.19.21.] [23.25.27.]] Subtractingtwoarrays: [[-11.-11.-11.] [-11.-11.-11.] [-11.-11.-11.]] Multiplyingtwoarrays: [[0.12.26.] [42.60.80.] [102.126.152.]] Dividingtwoarrays: [[0. 0.083333330.15384615] [0.214285710.266666670.3125 ] [0.352941180.388888890.42105263]] Program11:CreatedataframefromExcelsheetusingPandasandperform operations on data frames importpandasaspd #ReaddatafromexcelsheetsinanExcelfile data=pd.read_excel('file.xlsx',sheet_name='kavita') print("\n**Displaying Data from DataFrames**\n") print(data) print("\n**OPERATIONS ON DATAFRAMES**\n") print("\n1.ViewthefirstfewrowsoftheDataFrame:") print(data.head()) print("\n2.NumberofrowsandcolumnsintheDataFrame:",end="") print(data.shape) print("\n3.Filtereddata(Agecolumn<25):") filtered_data =data[data['Age'] < 25] print(filtered_data) print("\n4.SortDataFramebasedon'Age'colinascendingorder:") sorted_data = data.sort_values(by='Age', ascending=True) print(sorted_data) print("\nProgramClosed...") =========OUTPUT========= **DisplayingDatafromDataFrames** name Age marks 0 kiran 23 70 1 savita 20 90 2 kavya 25 80 3 sagar 18 70 4 sumit 21 56 5 sanket 22 50 6 akash 24 70 7 ramesh 26 40 8 ravi 27 45 9 soumya 28 90 10shilpa 17 65 **OPERATIONSONDATAFRAMES** ViewthefirstfewrowsoftheDataFrame: nameAgemarks kiran 23 70 savita 20 90 kavya 25 80 sagar 18 70 sumit 21 56 NumberofrowsandcolumnsintheDataFrame:(11,3) Filtereddata(Agecolumn<25): nameAgemarks kiran 23 70 savita 20 90 sagar 18 70 sumit 21 56 sanket 22 50 akash 24 70 10shilpa 17 65 SortDataFramebasedon'Age'colinascendingorder: name Age marks 10 shilpa 17 65 3 sagar 18 70 1 savita 20 90 4 sumit 21 56 5 sanket 22 50 0 kiran 23 70 6 akash 24 70 2 kavya 25 80 7 ramesh 26 40 8 ravi 27 45 9 soumya 28 90 ProgramClosed... 9 soumya 28 90 ProgramClosed...