← Back to challenges

The Forbidden Letter

PythonMediumarraysstringsloopsvalidation

Instructions

Given a letter and a list of words, return whether the letter does not appear in any of the words.

Examples

forbidden_letter("r", ["rock", "paper", "scissors"]) ➞ False

forbidden_letter("a", ["spoon", "fork", "knife"]) ➞ True

forbidden_letter("m", []) ➞ True

Notes

  • All inputs given will be in lowercase.
  • You will always be given a forbidden letter, but there may be empty lists.
python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Convert Kilometers to Miles