← Back to challenges

Get the File Extension

PythonHardstringshigher_order_functionsarrays

Instructions

Write a function that maps files to their extension names.

Examples

get_extension(["code.html", "code.css"])
➞ ["html", "css"]

get_extension(["project1.jpg", "project1.pdf", "project1.mp3"])
➞ ["jpg", "pdf", "mp3"]

get_extension(["ruby.rb", "cplusplus.cpp", "python.py", "javascript.js"])
➞ ["rb", "cpp", "py", "js"]

Notes

N/A

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Sum of Numbers in a List