Skip the Drinks with Too Much Sugar

Published by Matt in

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.
Watch a quick demo on how Edabit works.