First_half=YourString[:len(YourString)//2] Second_half=YourString[len(YourString)//2]
Here is what the above code is Doing:
1. We are creating a variable called ‘First_half’ and assigning it the value of the first half of the string.
2. We are creating a variable called ‘Second_half’ and assigning it the value of the second half of the string.
Now, let’s see how we can use this to reverse a string.