Get the File Extension

Published by Helen Yu in

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

Watch a quick demo on how Edabit works.