This is my script:
list = ["namaste", "hello", "ciao", "salut"]
# Ciao, Salut
# Hello, Ciao
# Namaste, Hello
for el, succ in reversed(zip(list, list[1:]))
print(el, succ)
unfortunately I am getting:
zip is not reversible
I would like to get the results you see in the comments.
- How can I do?
>Solution :
You can use zip:
l = ["Namaste", "Hello", "Ciao", "Salut"]
for a,b in zip(l[-2::-1], l[::-1]):
print(f'{a}, {b}')
output:
Ciao, Salut
Hello, Ciao
Namaste, Hello