-1

I have a code in which I am attempting to reverse a certain string. I have received instructions to only use index to do this, so I used index, and came to a halt when I found this. Here is my code first, for context.

emptyList = []
Len = len(var)
for i in range(Len, 0, -1):
    emptyList.append(i)

print(emptyList)

My problem is that whenever I print the variable emptyList, I only get a list of numbers, like such: [3, 2, 1]

I want the numbers to represent their character, like 3 = G, 2 = O. How do I do that?

akulsys
  • 1
  • 2

1 Answers1

0

Use emptyList.append(var[i-1]) not just i.

Shubham Periwal
  • 2,198
  • 2
  • 8
  • 26