Junior — Middle
How can you reverse the order of characters in a string?
sobes.tech AI
Answer from AI
In Python, to reverse the order of characters in a string, you can use slicing with a step of -1:
s = "Пример"
reversed_s = s[::-1]
print(reversed_s) # 'ремирП'
This method is the simplest and most efficient. It creates a new string with characters in reverse order.