Go practice
Practice Go online: 10 exercises and a playground
The Go here runs on yaegi, a genuine Go interpreter compiled to WebAssembly, so real syntax, types, slices, maps, structs and goroutines all behave as they do with the standard toolchain — with one honest limit: it is standard library only, with no third-party packages and no go.mod, so the exercises stay inside fmt, strings, bufio and the rest of what ships with Go itself.
- checked exercises
- 10
- graded problems
- 0
- lessons
- 0
- cheat sheet (coming)
- 0
Go practice exercises
How the path works →In order, each one introducing a single new idea. Press Run to check your answer; hints open one at a time.
- Library Due-Date ReminderDeclaring variables with := and printing them with fmt.Println and fmt.Printf, including a format string that must end with \n
- Recipe ScalerArithmetic on ints with +, -, *, and /, including that integer division truncates instead of rounding (7 / 2 is 3)
- Parking Meter StatusBranching with if / else if / else and comparison operators (<=, etc.)
- Bus TimetableCounting for loops (for i := 0; i < n; i++) that compute a new value on each pass
- Poem Word CounterReading a line with bufio, cleaning it with strings.TrimSpace, and splitting it into words with strings.Fields
- Tool Shed InventorySlices: literals, growing one with append (and keeping its result), indexing, and len() inside a loop
- Currency ConverterMaps: 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 LeaderboardWriting and calling a function with a parameter and a return value: func highestScore(scores []int) int
- Playlist RuntimeDefining a struct with fields and a method on it (func (s Song) Format() string), used across a slice of structs
- Tip Jar SplitCombining a struct, a helper function, and a loop to compute a proportional split with float formatting (%.1f and %.2f)
Coding interview questions
Original questions with full model answers, for when the practice is going somewhere specific.
Questions people ask
- Is this the real Go compiler?
- It is a real Go interpreter (yaegi) rather than the compiler you would run locally, so it understands genuine Go syntax and the standard library and reports real errors like an unused import — the trade-off is that it interprets rather than compiles to a native binary, and third-party packages are not available.
- Can I read input with bufio and os.Stdin?
- Yes. Lines typed into the input box beside the editor are what os.Stdin provides, so bufio.NewReader(os.Stdin) reads them exactly as it would on your own machine.
- Do I need go.mod or any setup?
- No. Every exercise is a single package main file with its own func main, pasted straight into the editor — there is no module system here, just the language and its standard library.
- What is here besides the exercises?
- The 10 exercises come first, and a blank playground is there for trying anything else you want to build with Go's standard library.
Practise another language
The same kind of practice hub exists for Python, JavaScript, TypeScript, Java, C++, C, C#, PHP, Ruby, SQL, R and Bash & the Shell.