q24.py(file created)
| @@ -0,0 +1,12 @@ | |||
| 1 | + | # Using NumPy, write a program to create two 1-dimensional array and perform the operation of iteration, sorting the | |
| 2 | + | # contents of array and concatenating the contents of the array. | |
| 3 | + | ||
| 4 | + | import numpy as np | |
| 5 | + | ||
| 6 | + | arr = np.array([9, 4, 6, 2, 7]) | |
| 7 | + | ||
| 8 | + | for e in np.nditer(arr): | |
| 9 | + | print(e) | |
| 10 | + | ||
| 11 | + | print(np.sort(arr)) | |
| 12 | + | print(np.concatenate((arr, np.array([38, 77, 29, 84, 75])))) | |
    
    
                            
                            更新
    
    
    更早