runtime
102 / 500
question 102 String Algorithms · easy

The file type is wrong for some uploads

An upload form decides how to store a file from its extension: the text after the last dot, in lower case, so report.final.PDF is pdf. A name with no dot, or ending in a dot, has no extension (""). file_extension gets report.final.PDF wrong and returns the whole name for README. Fix it.

Functionfile_extension(name)
Returnsthe lower-case text after the last ., or "" if there is no dot or nothing after it
Examples
callfile_extension('report.final.PDF')returns'pdf'
callfile_extension('README')returns''
callfile_extension('photo.jpg')returns'jpg'

Loading your progress…

The file type is wrong for some uploads — Python practice · Runtime