Write a python algorithm that transform a given string s by swapping the second character (s) with the befor last character. We assume that len(s) is greater or equal than 4. Example if s = “Python” , the algorithm returns the string: “Pothyn”.
n = len(s)
s_swap = s + s[n-2] + s[2:n-2] + s + s[n-1]
s = "Python"
print(swapping(s)) # the output is : Pothyn