reverse_string(s) that returns the reverse of the string s using slicing only — no loops, no reversed(), no .reverse(). This is the fastest, most Pythonic way to flip a string.s = 'hello'
'olleh'
Extended slicing with a step of -1 walks the string backwards.
s = 'DataVix'
'xiVataD'
Works for any string, including mixed case.
`s[::-1]` reads the string from end to start.
The step argument of a slice can be negative.