I have a question just purely try to improve my coding. Suggest I have a list:
a = [1, 2, 3]
I would like to print a result like below:
Path is: 1 --> 2 --> 3
My code works just fine:
text = ''
for j in range(len(a)):
text += str(a[j])
if j < len(a) - 1:
text = text + ' --> '
print('Path is:', text)
I am wondering, is there any better way to do it? Thank you.