Exerpad
🔥0
0 XP
Lv.1 Beginner
Log In

Student Grades

Create a HashMap that maps student names to their grades:

  • "Alice" got an "A"
  • "Bob" got a "B"
  • "Carol" got an "A"

Print each student and their grade in alphabetical order by name, in the format Name: Grade.

Expected output:

text
Alice: A
Bob: B
Carol: A

Hints:

  • Use .insert() to add each student
  • Collect keys, sort them, then loop through to print
rust
fn main() {
}