Manage Student Grades with Go Maps

GolangBeginner
Practice Now

Introduction

In this challenge, you need to create a simple grade tracking system to efficiently manage student performance using Go maps. As a teaching assistant, you will be tasked with implementing various operations such as adding students, retrieving and updating grades, and printing the current student grades.

Manage Student Grades with Go Maps

As a teaching assistant, you need to create a simple grade tracking system to efficiently manage student performance using Go maps.

Tasks

  • Create a map to store student names and their corresponding grades
  • Add at least 5 students to the grade tracking system (Alice, Bob, Charlie, David, Eve)
  • Print out all students and their current grades

Requirements

  • Use the file ~/project/student_grades.go for your implementation
  • Use a map with string keys (student names) and int values (grades)
  • Grades should be between 0 and 100

Examples

Run the program:

go run student_grades.go

Example output:

Student Grades:
Alice: 85
Bob: 92
Charlie: 78
David: 95
Eve: 88

Hints

  • Remember how to declare and initialize a map
  • Use the range keyword to iterate through map elements
  • Don't forget to use := for short variable declaration

Summary

In summary, this challenge requires you to create a simple grade tracking system using Go maps. You will need to implement operations such as adding students, retrieving and updating their grades, and printing the current student grades. The goal is to demonstrate your understanding of Go maps and their practical applications in managing student performance data.

✨ Check Solution and Practice