← Back to challenges

Superheroes

PythonHardarraysregex

Instructions

Create a function that takes a list of names of superheroes and superheroines and returns a list of only the names of superheroes ending in "man" in alphabetical order.

Examples

superheroes(["Batman", "Superman", "Spider-man", "Hulk", "Wolverine", "Wonder-Woman"])
➞ ["Batman", "Spider-man", "Superman"]

superheroes(["Catwoman", "Deadpool", "Dr.Strange", "Captain-America", "Aquaman", "Hawkeye"])
➞ ["Aquaman"]

superheroes(["Wonder-Woman", "Catwoman", "Invisible-Woman"])
➞ []

Notes

Wonder-Woman, Catwoman and Invisible-Woman are superheroines.

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Capitalize the First Letter of Each Word