← Back to challenges

Clear the Fog

PythonHardformattingstringsregex

Instructions

Create a function which returns the word in the string, but with all the fog letters removed. However, if the string is clear from fog, return "It's a clear day!".

Examples

clear_fog("sky") ➞ "It's a clear day!"

clear_fog("fogfogFFfoooofftogffreogffesGgfOogfog") ➞ "trees"

clear_fog("fogFogFogffoObirdsanffodthebffoeffoesGGGfOgFog") ➞ "birdsandthebees"

Notes

  • Hidden words won't include the letters f, o or g.
  • Hidden words are always in lowercase.
python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Even and Last