Wednesday, 28 August 2013

Returning list elements and indices

Returning list elements and indices

i am trying to print all the elements of a list using a user made function.
y = [1,2,3]
def ash(list1):
for x in range(len(list)):
return list[x],x
what i want to do is return all the values in the list with their
indices,but all i get is a single element.I can get the elements to print
but not return.

No comments:

Post a Comment