I'm trying to turn a full name into just the initials from one string. My logic is to capitalize all the names in the string, break the string by the spaces into a list, then select the first character of each index, then join the characters into a single string divided by periods.
I'm having trouble with this and not sure if there's a better way.
Here's my current progress:
def main():
fstn= input("Enter your full name:")
fstn=fstn.title()
fstn= fstn.split(" ")
for i in fstn:
fstn= i[0]
print(fstn)
main()
This prints out each initial on a different line, how would i finish this?
Hi check this example out,
def main():
fstn= input("Enter your full name:")
fstn=fstn.title()
fstn= fstn.split(" ")
out_str = ""
for i in fstn:
out_str = out_str + i[0] + "."
print(out_str)
main()