Manage Student Grades with Go Maps

GolangGolangBeginner
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.


Skills Graph

%%%%{init: {'theme':'neutral'}}%%%% flowchart RL go(("Golang")) -.-> go/DataTypesandStructuresGroup(["Data Types and Structures"]) go(("Golang")) -.-> go/FunctionsandControlFlowGroup(["Functions and Control Flow"]) go/DataTypesandStructuresGroup -.-> go/strings("Strings") go/DataTypesandStructuresGroup -.-> go/maps("Maps") go/FunctionsandControlFlowGroup -.-> go/for("For") subgraph Lab Skills go/strings -.-> lab-436735{{"Manage Student Grades with Go Maps"}} go/maps -.-> lab-436735{{"Manage Student Grades with Go Maps"}} go/for -.-> lab-436735{{"Manage Student Grades with Go Maps"}} end

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
โœจ Check Solution and Practice

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.