This can be reached in following ways
Method 1 : using the function enumerate()
for index, item in enumerate(my_list): print(index, item)
Method 2 : using the function range()
for i in range(0, len(my_list)): print(i, my_list[i])
Method 3: using WHILE loop
i=0 while(i<len(members)): print(i, members[i]) i += 1
Comments
Post a Comment