← Back to challenges

Removing Enemies

PythonHardarrayslanguage_fundamentals

Instructions

Remove enemies from the list of people, even if the enemy shows up twice.

Examples

remove_enemies(["Fred"], []) ➞ ["Fred"]

remove_enemies(["Adam", "Emmy", "Tanya", "Emmy"], ["Emmy"]) ➞ ["Adam", "Tanya"]

remove_enemies(["John", "Emily", "Steve", "Sam"], ["Sam", "John"]) ➞ ["Emily", "Steve"]

Notes

All names to be removed will be in the enemies list; simply return the list, no fancy strings.

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Lowercase and Uppercase Map