Write a Python program, to swap the first and the last character of a given string.
# define an example of string s
s = "Python"
# get the length of the string s
n = len(s)
# get the first character of the string s
first = s
last = s[n-1]
# extract the substring obtained from s ignoring the first and the last character
s1 = s[1:n-1]
# construct a new string by changing the first and last character
s2 = last + s1 + first
print(s2) # output: 'nythoP'