Beginner Projects
Prerequisites: Level 1 — Beginner
Build these on your own using what you learned in Level 1. Each one uses functions, lists, pattern matching, recursion, and simple input and output.
1. Number Guessing Game
Pick a secret number, read guesses with getLine, convert them with
readMaybe (from Text.Read), and answer "higher" or "lower" until the
player wins. Write the game loop as a recursive function that carries the
attempt count.
2. Word Frequency Counter
Read a paragraph, split it into lowercase words with words and map toLower, and print each distinct word with how many times it appears.
Use sort and group from Data.List.
3. Roman Numerals
Write toRoman :: Int -> String and fromRoman :: String -> Int using a
list of (value, symbol) pairs and recursion. Check that converting back
and forth gives the original number for 1 to 3999.
4. Grade Report
Store students as (name, [score]) tuples, compute each average with
sum and fromIntegral, turn it into a letter grade with guards, and
print an aligned report.
5. FizzBuzz, Five Ways
Write FizzBuzz with guards, with a case on a tuple of remainders, with a
list comprehension, with zipWith over cycling lists, and with recursion.
Compare which version reads best.