Exercise path · Go
10 Go exercises, in order
From your first line to a complete program you assembled yourself. Each exercise introduces exactly one new idea, runs in this tab, and tells you in plain language what happened.
How the path works
You never start from a blank editor. Every exercise hands you a program that already runs and asks you to change or add one thing, so the first success is minutes away and the last exercise is a program you can read top to bottom and explain. The ideas arrive in this order: variables and printing, arithmetic operators, conditionals (if/else), for loops, reading input and strings, slices, maps, functions, structs and methods, combining concepts.
Run is the check. There is no separate submit button: press Run, and the output is compared with what the exercise asked for. When it is not right, the feedback is a sentence about what happened — the line that differed, or what the error means — rather than a verdict. Hints come one at a time, and the answer opens only after you have run your code at least once, because reading the answer first is how you learn nothing.
Your finished exercises and the code you last had in the editor are saved in this browser, so a half-done exercise is still there tomorrow. Nothing is uploaded and there is no account.
The exercises
- Library Due-Date ReminderA two-line console message that reminds a borrower which book is due and how many days they have left.New idea: Declaring variables with := and printing them with fmt.Println and fmt.Printf, including a format string that must end with \n
- Recipe ScalerA program that takes a 4-serving recipe, works out the amount of flour and eggs per serving, and figures out what a doubled batch needs.New idea: Arithmetic on ints with +, -, *, and /, including that integer division truncates instead of rounding (7 / 2 is 3)
- Parking Meter StatusA program that subtracts elapsed time from paid time and prints whether the meter is OK, almost expired, or expired.New idea: Branching with if / else if / else and comparison operators (<=, etc.)
- Bus TimetableA program that lists five upcoming bus departure times, spaced out by a fixed interval.New idea: Counting for loops (for i := 0; i < n; i++) that compute a new value on each pass
- Poem Word CounterA program that reads one line of a poem from standard input (or falls back to a default line when there's no input) and reports how many words are in it.New idea: Reading a line with bufio, cleaning it with strings.TrimSpace, and splitting it into words with strings.Fields
- Tool Shed InventoryA numbered inventory listing for a tool shed, built from a slice that starts with three tools and gains a fourth.New idea: Slices: literals, growing one with append (and keeping its result), indexing, and len() inside a loop
- Currency ConverterA program that converts a fixed USD amount into euros, pounds, and yen using a map of fixed exchange rates.New idea: Maps: map[string]float64 literals, looking values up by key (including the zero-value gotcha for a missing key), and formatting floats with %.2f
- Board Game LeaderboardA leaderboard for a board game night that finds the top score with a helper function and marks the winning player.New idea: Writing and calling a function with a parameter and a return value: func highestScore(scores []int) int
- Playlist RuntimeA playlist printout showing each song's length as minutes:seconds, plus the total runtime of the whole playlist.New idea: Defining a struct with fields and a method on it (func (s Song) Format() string), used across a slice of structs
- Tip Jar SplitA program that splits a night's tip jar among three cafe workers, proportional to the hours each one worked.New idea: Combining a struct, a helper function, and a loop to compute a proportional split with float formatting (%.1f and %.2f)
After the path
The Go playground is where to build something of your own, and the Go guide sets out a learning order for everything after the basics. Everything you can practise Go with on this site is gathered on the Go practice hub. The same path also exists in Python, JavaScript, TypeScript, Java, C++, C, C#, PHP, Ruby, SQL, R and Bash & the Shell.