Sarah111-AHM / Semsmah

2 stars 0 forks source link

Lap4 #15

Open Sarah111-AHM opened 1 year ago

Sarah111-AHM commented 1 year ago

import numpy as np
names = np.array(['ahmed', 'mohammed', 'anas', 'foad', 'loay', 'gamal', 'saed'])
ids = np.array(['120215568', '120216874', '120219874', '120214532', '120212258', '120214521', '120217452'])
grades = np.array([[94,85,88], [75,89,91], [92,84,82], [74,78,81], [72,73,77], [64,82,78], [95,92,89]])
GPAs = np.array([89, 85, 86, 77, 74, 74, 92])
selected_students = GPAs > 85
print("Selected students:")

a)

```python
selected_students = GPAs > 85
selected_info = np.column_stack((names[selected_students], ids[selected_students], grades[selected_students]))
print("Selected students:")
print(selected_info)

Output:

Selected students:
[['ahmed' '120215568' '94' '85' '88']
 ['anas' '120219874' '92' '84' '82']]

b)

grades[GPAs > 90, 2] = 90

c)

grades[grades > 90] = 100