ARRAY #Initializing our array import numpy as np array1 = np.arange(9,dtype = np.float_).reshape(3, 3) #array1 = np.arange(9,dtype = np.int_) print('First Array:') print(array1) print('Second Array:') array2 = np.arange(11,20, dtype = np.float_).reshape(3, 3) #array2 = np.arange(11,20, dtype = np.int_) print(array2) print('\n Adding two arrays:') print(np.add(array1,array2)) print('\n Subtracting two arrays:') print(np.subtract(array1,array2)) print('\n Multiplying two arrays:') print(np.multiply(array1,array2)) print('\n Dividing two arrays:') print(np.divide(array1,array2)) BASIC REGULAR import re str="The rain in spain" x=re.findall("ai",str) print("search of string 'ai':",x) x=re.search("\s",str) print("The first white-space character is located in position:",x.start()) x=re.split("\s",str,1) print("spilt the string in the occurance of first white-space:",x) x=re.sub("\5","9",str) print("Each white-space is replaced with 9 digit:",x) print("---------------------------------------") #Metacharacters x=re.findall("[a-g]",str) print("The letters in between a to g in the string:",x) x=re.findall("spain$",str) if(x): print("\n",str,":yes,this string ends with 'spain' word") else: print("\n NO match") x=re.findall("^The",str) if(x): print("\n",str,":yes,this string starts with 'The' words") else: print("\n NOT match") str1="The rain in spain falls mainly in the plain" x=re.findall("ai*",str1) print("\n All ai matching characters:",x) if(x): print("yes,there is atlast one match") else: print("NO match") x=re.findall("all{1}",str1) print("\n The string which contains 'all':",x) if(x): print("yes,there is atlast one match") else: print("NO match") str2="That will be 59 dollars" x=re.findall("\d",str2) print("\n digits in the string:",x) x=re.findall("do...rs:",str2) print("\n Dont metacharacter matches any character:",x) LIST print("PROGRAM FOR BUILT-IN METHODS OF LIST \n"); animal=['cat','dog','rabbit'] print(animal) animal.append('cow') print("update animal list:",animal) language=['python','java','c++','french','c'] return_value=language.pop(3) print("removed element",return_value) print("update list:",language) vowels=['e','a','u','o','i'] vowels.sort() print("sorted list in Ascending:",vowels) vowels.reverse() print("sorted list in Descending:",vowels) vowel,insert(3,'0') print("update list:",vowels) animal=['cat','dog','rabbit','pig'] animal.remove('dog') print('update animal list:',animal) nums=['1','4','6','6','3','6'] nums.cleare() print("list after clear",nums) n=['vinu','sagar','aman'] n.sort() print(n)