Beginner Projects
Prerequisites: Level 1 — Beginner
Build these with nothing but what Level 1 covered — fmt, bufio,
strconv, slices, maps, functions, and structs.
1. Command-Line Calculator
Read two numbers and an operator (+ - * /) with a bufio.Scanner,
convert them with strconv.ParseFloat, and print the result. Return an
error from your calculate function for division by zero or an unknown
operator, and print a friendly message instead of crashing.
2. Number Guessing Game
Pick a random number with rand.IntN(100) + 1 (from math/rand/v2),
then loop, reading guesses and printing "Too high" / "Too low" until the
player guesses correctly. Count and print the number of attempts.
3. Word Frequency Counter
Read a line of text, split it with strings.Fields, lower-case each word,
and count occurrences in a map[string]int. Print each word with its
count — then sort the words alphabetically first, so the output order is
stable.
4. Console To-Do List
Keep tasks in a []Task slice, where Task is a struct with a Title
and a Done flag. Loop, presenting a menu (add / list / done / quit)
handled with a switch.
5. Grade Book
Store student names and scores in a map[string][]int. Write functions
that compute each student's average and the class's highest average,
and print a formatted report with fmt.Printf (%-10s %6.1f).