How can I get a user to break out of a loop via text input?

Lets say a teacher wants to add n number of students to a database.

n = 1000
students = dict(input("enter students name and grade. Example 'Student C: '").split()
    for _ in range(n))
print(students)

This is fine if we have 1000 students, but what if the teacher wants to finish after 10 students? Is there a way we can input “quit” to break the loop?

Answer

m = {}
while True:
    grade = input("enter students name and grade. Example 'Student C: '").split()
    if grade[0] == 'quit':
       break
    else:
        m[grade[0]] = grade[1]


print(m)