enumerate sometimeswhen we're looping over container in for loopwe want access to the index (the current position in the listof the current item being processed the for loop doesn' provide us with indexesbut the enumerate function gives us something betterit creates sequence of tupleswhere the first object in each tuple is the index and the second is the original item this is useful if we need to use index numbers directly consider some simple code that outputs each of the lines in file with line numbersimport sys filename sys argv[ with open(filenameas filefor indexline in enumerate(file)print("{ }{ }format(index+ line)end=''running this code using it' own filename as the input file shows how it works import sys filename sys argv[ with open(filenameas file for indexline in enumerate(file) print("{ }{ }format(index+ line)end=''the enumerate function returns sequence of tuplesour for loop splits each tuple into two valuesand the print statement formats them together it adds one to the index for each line numbersince enumeratelike all sequencesis zero-based we've only touched on few of the more important python built-in functions as you can seemany of them call into object-oriented conceptswhile others subscribe to purely functional or procedural paradigms there are numerous others in the standard librarysome of the more interesting ones includeall and anywhich accept an iterable object and return true if allor anyevalexecand compilewhich execute string as code inside the interpreter of the items evaluate to true (such as nonempty string or lista nonzero numberan object that is not noneor the literal truebe careful with these onesthey are not safeso don' execute code an unknown user has supplied to you (in generalassume all unknown users are maliciousfoolishor both