Part of the series

Several example codes

~1 min read • Updated Oct 7, 2025

Program Overview

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).


Python Code:


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}")

Sample Output:


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

Step-by-Step Explanation:

- 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


Written & researched by Dr. Shahin Siami