Skip to main content
added 31 characters in body
Source Link
Danis
  • 773
  • 6
  • 15

Python 3.8 (pre-release), 3737 34 bytes

def f(l,i=0):print(l[i]);f(l,l[i])  while

Try it online!

thanks user for helping save 3 bytes

slightly modified version of 31 bytes, but it prints an extra zero at the beginning

def 1f(l,i=0):print(i:=l[i]);f(l,l[i]) 

Try it online!Try it online!

Python 3.8 (pre-release), 37 bytes

def f(l,i=0):  while 1:print(i:=l[i]) 

Try it online!

Python 3.8 (pre-release), 37 34 bytes

def f(l,i=0):print(l[i]);f(l,l[i]) 

Try it online!

thanks user for helping save 3 bytes

slightly modified version of 31 bytes, but it prints an extra zero at the beginning

def f(l,i=0):print(i);f(l,l[i]) 

Try it online!

Post Undeleted by Danis
deleted 42 characters in body
Source Link
Danis
  • 773
  • 6
  • 15

Python 3Python 3.8 (pre-release), 6637 bytes

def f(l,i=0): a=l[0],l[l[0]] while a[0]-a[-1]1:a+=l[a[-1]], return aprint(i:=l[i]) 

Try it online!Try it online!

Python 3, 66 bytes

def f(l): a=l[0],l[l[0]] while a[0]-a[-1]:a+=l[a[-1]], return a 

Try it online!

Python 3.8 (pre-release), 37 bytes

def f(l,i=0): while 1:print(i:=l[i]) 

Try it online!

Post Deleted by Danis
Source Link
Danis
  • 773
  • 6
  • 15

Python 3, 66 bytes

def f(l): a=l[0],l[l[0]] while a[0]-a[-1]:a+=l[a[-1]], return a 

Try it online!