mercredi 13 juillet 2016

Enumeration function Argument


Python enumeration function enumerate takes one argument start. What is the use of this argument ? If i write some code using this argument it shifts only index e.g. >>a=[2,3,4,5,6,7] >>for index,value in enumerate(a,start=2): ... print index,value ... **2 2** 3 3 4 4 5 5 6 6 7 7 8 8 So index is changed to 2 ,Not Value.Value is still started from first element. Why this is so ? In place of this functionality ,It could be better if value is started from that index rather than starting element. What was the thinking behind the implementation of this ?

Aucun commentaire:

Enregistrer un commentaire