For school I have to write a program that requests a 3 part name and breaks it into a first, middle, and last name. I wrote the code but the alignment of my output is not right. I was wonderng if someone can tell me what I did wrong and how to fix it. Any help would be appreiated. Thanks!
def main():
name=input("Please enter a full name with 3 names, separated by one space: ")
space=name.find(" ")
first=name[:space]
middle=name[space+1:]
secondname=middle[:space]
last=middle[space:]
print(first)
print(secondname)
print(last)
main()
Output:
Please enter a full name with 3 names, separated by one space: francis ford coppola
francis
ford co
ppola
Please enter a full name with 3 names, separated by one space: billy dee williams
billy
dee w
illiams