The code below will traverse over a string going forwards. Without using a second loop, can you get it to display the letters of the word both forwards and backwards at the same time. For example –
input – tiger
word = input("Enter a word") pos = 0 while pos < len(word): print(word[pos]) pos = pos + 1
You need to log in or create an account to submit code!