This is my code...
As always any help is most appreciated!!
def get_formatted_name(first_name, middle_name, last_name): """Return a full name, neatly formatted.""" if middle_name: full_name = first_name + ' ' + middle_name + ' ' + last_name else: full_name = first_name + ' ' + last_name return full_name.title() musician = get_formatted_name('john', 'lee', 'hooker') print(musician) musician = get_formatted_name('jimi', 'hendrix') print(musician)This is what I get...
Error:John Lee Hooker
Traceback (most recent call last):
File "C:/Python Tutorials/formatted_name.py", line 12, in <module>
musician = get_formatted_name('jimi', 'hendrix')
TypeError: get_formatted_name() missing 1 required positional argument: 'last_name'
As you can see it works for John Lee Hooker. This is because it has first, middle and last names. The second Jimi Hendrix, doesn't work (I think) because it's missing a middle name.As always any help is most appreciated!!