To ensure the program functions correctly, you should test valid grade inputs (9, 10, 11, 12) to confirm that the appropriate class names are printed, as well as invalid inputs (e.g., numbers outside the high school range like 8, 13, or negative numbers) to verify that it outputs "Not in High School." Additionally, testing with non-integer inputs (like strings or float values) should also be conducted to ensure the program handles exceptions properly.
Suppose you are writing code to process data from a questionnaire. One of the questions is what grade are you in? The code looks as given below.
gr = int(input("What grade are you in? "))
if (gr == 9):
print("Freshman")
elif (gr == 10):
print("Sophomore")
elif (gr == 11):
print("Junior")
elif (gr == 12):
print("Senior")
else:
print("Not in High School")
In 1-2 sentences, describe the data points that you should test to make sure that program is working properly.
1 answer