Reputation: 2403
In python is there a way to inverse a string using a 'for i in string' but starting from the last char rather than the first? I would like to avoid using a counte rand I do not want to use INVERSE. Thanks for the feedback!
string = 'caramelosticosis'
new_string = ''
cont = 0
for i in string:
cont+=1
new_string += string[-cont]
print(new_string)
Upvotes: 0
Views: 98