challenges
small puzzles to practice the language. each one opens in the playground with starter code — finish it, run it, and check the goal.
01warm up: shout your name
start it →goal: make the program print your name in capital letters, three times on one line.
hint: upper makes text loud, repeat repeats a string, and + glues strings together.
let name = "ada" // make it shout: ADA ADA ADA print(name)
02sum the odd ones
start it →goal: add up only the odd numbers from 1 to 20 and print the total (it should be 100).
hint: a for loop over range(1, 21), an if with % 2, and += — or filter and sum in a pipe.
let total = 0 for n in range(1, 21) { // add n only when it is odd } print(total)
03find the longest word
start it →goal: print the longest word in the list (it should be "lumencoding").
hint: keep a best-so-far variable, walk the list, and compare with len(word).
let words = ["code", "lumencoding", "glow", "play"] let best = "" for w in words { // update best when w is longer } print(best)
04tiny scoreboard
start it →goal: sort the players by score, highest first, and print each line as "name: score".
hint: sort takes a comparator fn(a, b), and entries of a map give you [key, value] pairs to build the list first.
let scores = { ada: 12, grace: 25, edsger: 8 } // turn entries into a sorted list, then print each line
05secret whisper
start it →goal: hide the vowels: print the message with every "a", "e", "i", "o", "u" replaced by "*".
hint: chars splits text into letters; map over them, swap vowels, then join("") back together.
let message = "lumen glows in the dark" // replace each vowel with * and print the result
stuck? the docs list every built-in, and the playground's AI helper can explain an error in plain words.