Python Foundation

+91-7982108418

NUMPY BASIC
1.Write a NumPy program to get the numpy version and show numpy build configuration.

2. Write a NumPy program to get help on the add function.

3. Write a NumPy program to test whether none of the elements of a given array is zero.

4. Write a NumPy program to test whether any of the elements of a given array is non-zero.

5. Write a NumPy program to test a given array element-wise for finiteness (not infinity or not a Number).

6. Write a NumPy program to test element-wise for positive or negative infinity.

7. Write a NumPy program to test element-wise for NaN of a given array.

8. Write a NumPy program to test element-wise for complex number, real number of a given array. Also test whether a given number is a scalar type or not.

9. Write a NumPy program to test whether two arrays are element-wise equal within a tolerance.

10. Write a NumPy program to create an element-wise comparison (greater, greater_equal, less and less_equal) of two given arrays.

11. Write a NumPy program to create an element-wise comparison (equal, equal within a tolerance) of two given arrays.

12. Write a NumPy program to create an array with the values 1, 7, 13, 105 and determine the size of the memory occupied by the array.

13. Write a NumPy program to create an array of 10 zeros,10 ones, 10 fives.

14. Write a NumPy program to create an array of the integers from 30 to70.

15. Write a NumPy program to create an array of all the even integers from 30 to 70.

16. Write a NumPy program to create a 3×3 identity matrix.

17. Write a NumPy program to generate a random number between 0 and 1.

18. Write a NumPy program to generate an array of 15 random numbers from a standard normal distribution.

19. Write a NumPy program to create a vector with values ranging from 15 to 55 and print all values except the first and last.

20. Write a NumPy program to create a 3X4 array using and iterate over it.

21. Write a NumPy program to create a vector of length 10 with values evenly distributed between 5 and 50.

22. Write a NumPy program to create a vector with values from 0 to 20 and change the sign of the numbers in the range from 9 to 15.

23. Write a NumPy program to create a vector of length 5 filled with arbitrary integers from 0 to 10.

24. Write a NumPy program to multiply the values of two given vectors.

25. Write a NumPy program to create a 3×4 matrix filled with values from 10 to 21.

26. Write a NumPy program to find the number of rows and columns of a given matrix.

27. Write a NumPy program to create a 3×3 identity matrix, i.e. diagonal elements are 1, the rest are 0.

28. Write a NumPy program to create a 10×10 matrix, in which the elements on the borders will be equal to 1, and inside 0.

29. Write a NumPy program to create a 5×5 zero matrix with elements on the main diagonal equal to 1, 2, 3, 4, 5.

30. Write a NumPy program to create a 4×4 matrix in which 0 and 1 are staggered, with zeros on the main diagonal.

31. Write a NumPy program to create a 3x3x3 array filled with arbitrary values.

32. Write a NumPy program to compute sum of all elements, sum of each column and sum of each row of a given array.

33. Write a NumPy program to compute the inner product of two given vectors.

34. Write a NumPy program to add a vector to each row of a given matrix.

35. Write a NumPy program to save a given array to a binary file.

36. Write a NumPy program to save two given arrays into a single file in compressed format (.npz format) and load it.

37.Write a NumPy program to save a given array to a text file and load it.

38. Write a NumPy program to convert a given array into bytes, and load it as array.

39. Write a NumPy program to convert a given array into a list and then convert it into a list again.

40. Write a NumPy program to compute the x and y coordinates for points on a sine curve and plot the points using matplotlib.

41. Write a NumPy program to convert numpy dtypes to native python types.