Kodewick
Start learning →
Mini challenge←→0 / 100

Merge the snack lists

#056Mini challengeListsLoops5 min

You and your best friend each wrote a picnic snack list. Write merge_snacks(mine, yours) to make one list: yours first, then your friend's, with each snack only once (where it first shows up).

Examples
merge_snacks(["chips", "grapes"], ["cookies", "chips"])→['chips', 'grapes', 'cookies']
merge_snacks([], ["juice"])→['juice']
main.py
def merge_snacks(mine, yours):
    merged = []
    for snack in mine + yours:
        # your code here: add it only if merged lacks it
        pass
    return merged
Ctrl + Enter runs too
Result

Run tries the examples. When they look right, Submit.