Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions

Question

1 The meaning of the balance of payments accounts

Answered: 1 week ago