Flipping strings in Python

Asked 2 years ago, Updated 2 years ago, 37 views

I looked up str object and there was no reverse function Where can I find it?

string python

2022-09-21 18:18

1 Answers

str[::-1]

The slice syntax is [start:end:step]. Since we didn't specify start and end, we specified the range from start to end The index increases by -1.

''.join(reversed(s))


2022-09-21 18:18

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.