"C M Caine" <cmca...@googlemail.com> wrote
for i in range(len(timetable)): numDict[timetable[i]] += 1 if spaceDict['1st'+timetable[i]] == 0: spaceDict['nth'+timetable[i]] = i
for index, item in enumerate(timetable): numDict[item] += 1 if spaceDict['1st'+item] == 0: spaceDict['nth'+item] = i
This function works fine, but I think that using range(len(timetable)) is clumsy. On the other hand, I need the indexes to track the number
enumerate() is your friend. HTH, Alan G _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor