Seeing Double

Python FundamentalsHard+10 XP+10

Seeing Double

Write a function first_double_letter(word) that returns the first letter that appears twice in a row.

  • If no letter appears twice in a row, return an empty string "".
  • The two letters must be next to each other: "banana" has three as but none side by side, so it returns "".
  • Capitals count as different letters: "Aa" returns "".
  • An empty word returns "".

Examples

word = "coffee"
returns 'f'
word = "latte"
returns 't'
word = "mocha"
returns ''
word = "bookkeeper"
returns 'o'

Hints

Solve it to unlock the solution

Once your code passes every test, a reference solution shows up here so you can compare it with yours.

solution.py
CtrlEnterto run