LearnPy Hub
← Modules & the Standard Library problems
Medium

Count File Extensions

Read file names on one line. Use os.path.splitext to get each extension and print each extension (alphabetical) with its count as ext count. A name with no extension counts under (none).

Input

File names separated by spaces.

Output

Lines.

Sample 1

Input
a.py b.txt c.py README
Output
(none) 1
.py 2
.txt 1

Sample 2

Input
photo.jpg
Output
.jpg 1
solution.py
Output appears here
Count File Extensions · Python practice problem · LearnPy Hub