I have a task to rearrange a name to last first middle initial. I know for this I can use split() but I’m trying to understand it the way I’m learning it right now which is index and find ect to rearrange it. My question is how would I make it so the program knows what is the first last and middle names since it changes depending on user input. I’ve tried this and it doesn’t work. Is there a way to do this?
Name = input("Enter a name like 'First I. Last: ") words = Name.find(" ") first, middle, last = words, words, words[-1]
Source: Python Questions