Q. Write a code to sort a numerical list in Python?
A. The following code can be used to sort a numerical list in Python:
list = [“2”, “5”, “7”, “8”, “1”]
list = [int(i) for i in list]
Q. What is a map function in Python ?
A. The map() function in Python has two parameters, function and iterable. The map() function takes a function as an argument and then applies that function to all the elements of an iterable, passed to it as another argument. It returns an object list of results.
numbers = (2, 3, 4, 5)
result = map( calculateSq, numbers)
Q. Write a code to get indices of N maximum values in a NumPy array?
A. We can get the indices of N maximum values in a NumPy array using the below code:
import numpy as npar = np.array([1, 3, 2, 4,5,6])
Q. What is a Python module how it will create by you?
A. Modules are independent Python scripts with .py extension that can be reused in other Python codes or scripts using the import statement. A module can consist of functions, classes, and variables, or some runnable code. Modules not only help in keeping Python codes organized but also in making codes less complex and more efficient. The syntax to import modules in Python codes is as follows.
Will catch you soon updated Interview Questions and Answers on next Series
for Top SQL Server Interview Questions and Answers