← Back to challenges

Skip the Drinks with Too Much Sugar

PythonMediumarrayslanguage_fundamentals

Instructions

Write a function that takes a list of drinks and returns a list of only drinks with no sugar in them. Drinks that contain sugar (in this challenge) are:

  • cola
  • fanta

Examples

skip_the_sugar(["fanta", "cola", "water"]) ➞ ["water"]

skip_the_sugar(["fanta", "cola"]) ➞ []

skip_the_sugar(["lemonade", "beer", "water"]) ➞ ["lemonade", "beer", "water"]

Notes

  • The function returns an array of strings.
  • All drink names are in lowercase.
python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Summing a Slice