Question
I have been laboring on this problem and I keep getting this darn error every time I run the code. I sure hope you can
I have been laboring on this problem and I keep getting this darn error every time I run the code. I sure hope you can help me with this problem. Thanks for all your help.
name = input()
split_name - name.split()
firstName - split_name[0]
middleName = spli_name[1]
if len(split_name) --2:
print(middleName + ',', firstName[0:1] + '.')
if len(split_name) --3:
lastName = split_name[2]
print(lastName + ',', firstName[0:1] + '.' + middleName[0:1] + '.')
Traceback (most recent call last):
File "main.py", line 3, in
split_name - name.split()
NameError: name 'split_name' is not defined
Ex: If the input is:
Pat Silly Doe
the output is:
Doe, P.S.
If the input has the form:
firstName lastName
the output is:
lastName, firstInitial.
Ex: If the input is:
Julia Clark
the output is:
Clark, J.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started