This Python program first reads the number of students n.
Then it reads n GPA values and counts how many of them fall within the range of 10 to 15 (inclusive).
n = int(input("Enter number of students: "))
count = 0
for i in range(n):
grade = float(input(f"Enter GPA for student {i + 1}: "))
if 10 <= grade <= 15:
count += 1
print(f"Number of students with GPA between 10 and 15: {count}")
Enter number of students: 5
Enter GPA for student 1: 9.8
Enter GPA for student 2: 12.5
Enter GPA for student 3: 15.0
Enter GPA for student 4: 16.2
Enter GPA for student 5: 10.0
Number of students with GPA between 10 and 15: 3
- The program first reads the number of students
- Then it loops through each student and reads their GPA
- If the GPA is between 10 and 15 (inclusive), the counter is incremented
- At the end, the total count is displayed