You just need the index of the begin station then loop from that index + 1 to the length of the list using an inner loop to print all the stations from the current i
to the end:
stations = ["Station A", "Station B", "Station C", "Station D"]
begin = input("What is your begin station?")
end = input("What is your end station?")
ind = stations.index(begin) + 1
for i in range(ind, len(stations)):
for j in range(i,len(stations)):
print(stations[j])
print()
Output:
What is your begin station?Station A
What is your end station?Station B
Station B
Station C
Station D
Station C
Station D
Station D
Not sure how the end station fits into it, if you actually want to start from the end station then use ind = stations.index(end)
and don't + 1
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…