Professional Documents
Culture Documents
Python Lab3 Excercise Solutions
Python Lab3 Excercise Solutions
(An autonomous institution affiliated to VTU, Belagavi, Approved by AICTE, New Delhi, Accredited
by NAAC with 'A++' grade & ISO 9001:2015 Certified)
#copy()
oldsalaries=np.copy(salaries)
index= int(input())
#sort()
np.sort(oldsalaries)
np.sort(salaries)
print('------------------------------------')
print('Sorted salaries are:')
print('old Salaries:',oldsalaries)
print('Current Salaries:',salaries)
#Display the salaries of the employees in a given range of indices ‘m’- ‘n’.
print('enter a valid range in 0-',no_emp-1)
m,n = input().split()
print('------------------------------------')
print("salaries in range:",m,"to",n,"are:")
print(salaries[int(m):int(n)])
2. Develop a program to read marks of two sections of a class using NumPy arrays.
Then do the following using the b
uilt-in functions:
i. Display the marks of whole class by merging the details (use
concatenate()).
ii. Display the marks of a student searched using searchsorted().
"""
std= np.searchsorted(whole_USNs,usn)
#read matrix
for i in range(0,int(m)):
print('enter ',n,'elements separated by space')
mat[i]=input().split()
#display matrix
print('---------------------------------------------------')
print('the matrix is ',mat)
#Multiply a matrix elements with a value ‘x’ and display the same
print('---------------------------------------------------')
a=int(input('enter a value'))
print('array after multiplication')
print(mat*a)
#read matrix
for i in range(0,int(m1)):
print('enter ',n1,'elements separated by space')
mat1[i]=input().split()