Write a NumPy program to sort pairs of first name and last name return their indices. (first by last name, then by first name)
- برمجة بايثون
- 2021-09-12
- mhanasmh00489829403
الأجوبة
import numpy as np
first_names = ('Margery', 'Betsey', 'Shelley', 'Lanell', 'Genesis')
last_names = ('Woolum', 'Battle', 'Plotner', 'Brien', 'Stahl')
x = np.lexsort((first_names, last_names))
print(x)
Sample Output:
[1 3 2 4 0]
أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال