x = [‘r’,‘b’,‘a’]

for i in range(len(x)):

print x[-(i+1)]

So I found this code while looking online…but I don’t understand this part “[-(i+1)]”. Can somebody explain?

x = [‘r’,‘b’,‘a’]

for i in range(len(x)):

print x[-(i+1)]

So I found this code while looking online…but I don’t understand this part “[-(i+1)]”. Can somebody explain?

I have inserted some print statements in the original code. Check it out if it helps

```
x = ['r','b','a']
for i in range(len(x)):
print "The current index i is ",i
print "but -(i+1) will be ",-(i+1)
print "The element at position ",-(i+1), " is ", x[-(i+1)],"\n"
```

#or

**TEST IT HERE**