var = input("Enter the String: ")
def capitalizeFirstLast(x):
x = x.lower()
x = list(x)
x[0] = x[0].upper()
x[len(x)-1] = x[len(x)-1].upper()
for i in range(len(x)):
if x[i] == ' ':
x[i-1] = x[i-1].upper()
x[i+1] = x[i+1].upper()
return(''.join(x))
print(capitalizeFirstLast(var))
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Python