On 11/03/2016 01:21, Mark Lawrence wrote:
On 11/03/2016 00:05, BartC wrote:
def last(a): return a[-1] def init(a): # all except last element return a[0:len(a)-1]What is wrong with a[0:1] ?
The returns the head of the list. I need everything except the last element ('init' is from Haskell).
for i in range(len(names)): print (names[i],totals[i])Always a code smell when range() and len() are combined.
Any other way of traversing two lists in parallel? -- Bartc -- https://mail.python.org/mailman/listinfo/python-list
