I am taking a course in basics to python and I am stuck on this lab where we have to take the input a full name:
ex Pat Silly Doe
and print it as
Doe, P.S.
or in the case they did not input a middle name it would just read:
Doe, P.
We are only on slicing and formatting strings no if else yet but I feel I am overthinking this
I know I need to slice the input and I can do that by:
name = input()
splitname = name.split(' ')
print(splitname)
and that will split each part of the user inputs name up by the whitespaces entered which will then let me know if its 2 names or all 3. But I am kind of lost now as to what to do next. Now that I have the name split up how do I without printing it take each name and format it.
I'm not trying to get a direct answer to the lab I don't want to just copy paste code in to do it, I just want a little bump in the right direction.