← Back to challenges

Between Words

PythonHardstringsvalidation

Instructions

Write a function that takes three string arguments (first, last, and word) and returns True if word is found between first and last in the list, otherwise False.

Examples

is_between("apple", "banana", "azure") ➞ True

is_between("monk", "monument", "monkey") ➞ True

is_between("bookend", "boolean", "boost") ➞ False

Notes

  • All letters will be in lowercase.
  • All three words will be different.
  • Remember that the string word is in the middle.
python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: What Type of Triangle?