Skip to content
Exercise · Conditions · lesson 6 of 7

Exercise: letter grade

Write a function func grade(score int) string that turns a score into a grade. For 90 points or more it returns "A", for 75–89 "B", for 60–74 "C", and below 60 "F".

  • grade(90) → "A"
  • grade(74) → "C"
  • grade(59) → "F"

Constraints: score is an integer from 0 to 100 inclusive.

Do not add extra imports unless the task says so explicitly.

grade.go — go
go · 6 lines
Ctrl+Enter run · Esc leave editor

Subscribe to take the course

The course is free. Sign in with Telegram and subscribe to the channel to open every lesson.

Sign in another way