Valid Foundations-of-Programming-Python Dumps shared by EduDump.com for Helping Passing Foundations-of-Programming-Python Exam! EduDump.com now offer the newest Foundations-of-Programming-Python exam dumps, the EduDump.com Foundations-of-Programming-Python exam questions have been updated and answers have been corrected get the newest EduDump.com Foundations-of-Programming-Python dumps with Test Engine here:
A program processes file names and extracts the last 3 characters representing the file extension. For example, files ' document.pdf ' and ' image.png ' would return ' pdf ' and ' png ' , respectively. Which slicing approach would work for either of the provided files?
Correct Answer: C
The slice filename[-3:] extracts the last three characters from a string. Example: filename = " document.pdf " print(filename[-3:]) Output: pdf Another example: filename = " image.png " print(filename[-3:]) Output: png Python strings support slicing, and negative indexes count from the end of the string. Therefore, the correct answer isC. filename[-3:] .