-2
I have this code as an example:
# 0 1 2 3 4
lista = ['1','2','3','4','5']
def nexxt():
for item in range(len(lista)):
item += 1
print(lista[item])
def back():
for item in range(len(lista)):
item -= 1
print(lista[item])
I want to print every object on every call... Like I call Nexxt he prints 1 because 0 is gone, I call again and he prints 2 and so it goes...and with the back the opposite...I want to adapt this to a project where I can jump and return songs where the list will have the name of each . mp3 and the pygame/ mixer does the rest
This code is not useful, because it does not return correctly from 0 to 4...if someone can give me a light
Why do this if you can use a variable as an index.
– Augusto Vasques
What exactly do you want to do? You just want to print the list elements, or you want to print the contents?
– hkotsubo
I want to print every object on every call... Like I call nexx he prints 1 because 0 is gone, I call again and he prints 2 and so it goes...and with the back the opposite... mp3 and the pygame/ mixer does the rest
– Jubiluleu