#C13168. Grade Categorization
Grade Categorization
Grade Categorization
You are given a list of tokens representing student grades. Your task is to categorize these grades into five letter categories:
- A: Grades in the interval \([90, 100]\)
- B: Grades in the interval \([80, 90)\)
- C: Grades in the interval \([70, 80)\)
- D: Grades in the interval \([60, 70)\)
- F: Grades in the interval \([0, 60)\)
Any token that cannot be parsed as a number or is a numeric value but is not within the range \([0, 100]\) should be considered invalid. When an invalid grade is encountered, print an error message: "Invalid grade ignored: grade" (one per line) before processing the rest.
After processing all tokens, output a dictionary (using Python dictionary literal format) with keys "A", "B", "C", "D", and "F". Each key maps to a list of grades that fall in that category. The order of grades in each list should match the order of their appearance in the input.
inputFormat
The input is read from standard input (stdin). The first line contains an integer \(N\) representing the number of tokens. The second line contains \(N\) space-separated tokens. Tokens that can be converted to a numeric value (integer or float) and fall between 0 and 100 (inclusive at the upper bound for A) will be categorized, otherwise they are treated as invalid.
outputFormat
The program should output to standard output (stdout). For each invalid token, output a line with the error message in the format: "Invalid grade ignored: ". After processing all tokens, output the final dictionary in Python's dictionary literal format. Make sure the output exactly matches the expected order and format.
## sample5
95 85 75 65 55
{'A': [95], 'B': [85], 'C': [75], 'D': [65], 'F': [55]}