Python Programming Questions
Python Programming Questions
1. Write a Python program to create an array of 20 evenly spaced values between 1 and 10
using NumPy. Also, demonstrate how to generate an array of 10 random values between 0
and 1.
2. Write a program to demonstrate the use of advanced indexing in NumPy. Select specific
elements from a 2D array using index arrays and explain the results.
4. Write a Python program that iterates over a multi-dimensional NumPy array and prints
each element along with its index. Use at least two different iteration methods.
5. Write a Python program to reshape a 1D array into a 3x4 2D array. Also, demonstrate
how to concatenate two arrays along different axes.
6. Write a Python program that uses binary operators on two NumPy arrays. Perform AND,
OR, and XOR operations and display the output for each operation.
8. Write a Python program to compute the sine, cosine, and tangent of an array of angles in
radians. Also, demonstrate the use of other mathematical functions like exponential and
logarithms.
10. Write a Python program to handle arrays containing NaN values. Demonstrate how to
detect NaN, replace NaN with a specified value, and calculate the sum of the array ignoring
NaN values.