← Back to challenges

Fridge Poetry

PythonHardstringsvalidation

Instructions

Write a function that returns True if it's possible to build a phrase txt1 using only the characters from another phrase txt2.

Examples

can_build("got 2 go", "gogogo 2 today") ➞ True

can_build("sit on top", "its a moo point") ➞ True

can_build("long high add or", "highway road go long") ➞ False

can_build("fill tuck mid", "truck falls dim") ➞ False

Notes

  • All letters will be in lower case.
  • Numbers and special characters included.
  • Ignore whitespaces.
  • Do not count white space as a character.
python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.