All challenges

Tuesday, 22 September 2026

Past

Three rungs, one idea. Solving rung 1 counts. Climb as far as you can.

Backwards Words

strings + building backwards

Rung 1Daily goal5 points

Turn a word around

Write a function called reverse_word

Return the word with its letters in the opposite order, so "cat" becomes "tac". Build the new word one letter at a time with a loop. An empty word returns an empty word.

Examples

InputOutput
"cat""tac"
""""
"a""a"
"hello""olleh"

There are extra hidden tests, so make it work in general, not just for these.

Rung 2Bonus7 points

Same both ways

Write a function called is_palindrome

A word is a palindrome when it reads the same forwards and backwards, like "noon". Every word is lowercase letters with no spaces. Return True if the word is a palindrome and False if it is not. An empty word counts as a palindrome, so return True for it.

Examples

InputOutput
"noon"True
"cat"False
""True
"a"True

There are extra hidden tests, so make it work in general, not just for these.

Rung 3Bonus10 points

The longest one

Write a function called longest_palindrome

words is a list of lowercase words. Return the longest word that reads the same both ways. If two of them are the same length, return the one that comes first in the list. If no word reads the same both ways, and also when the list is empty, return None.

Examples

InputOutput
["cat", "noon", "level"]"level"
["cat", "dog"]None
[]None
["noon", "abba"]"noon"

There are extra hidden tests, so make it work in general, not just for these.

Finish Rung 1 and today counts. Rungs 2 and 3 are there if you want to push further.