I'm working on a problem for a CS intro class. Though I've gotten it to work, I haven't gotten it to work properly.
This is the assignment: Write a program which reads a string using input(), and outputs the same string but with the first and last character exchanged. (You may assume the input string has length at least 2.) For example, on input Fairy a correct program will print yairF. Hint: use your solution to the previous program as part of the answer.
This is my code:
user_input = input()
print(user_input[len(user_input)-1],user_input[1:len(user_input)-1],user_input[0])
Unfortunately, my output is "y air F" instead of "yairF". How would I be able to concatenate this indexing without the white-spaces? I've tried many things unsuccessfully and I haven't been able to find anything in my search to help. I'm supposed to be able to make this happen using the len funtion, and indexing substrings.
Thank you in advance from a complete newb to Python!