Jun-23-2020, 06:43 AM
I am having difficulty getting the expected outcome. I'm working exercises in a Python book. I would like: as soon as a person enters their first and last name for the message to appear (Hello, formatted name). What have I done incorrectly? I have played around with indentation and checked the author's key. I do not see any errors on my part, but like I said I am not getting the expected outcome.
def get_formatted_name(first_name, last_name):
full_name = f"{first_name} {last_name}"
return full_name.title()
# This is an infinite loop until conditions are added.
while True:
print(f'\nPlease tell me your name:')
print("(enter 'q' at any time to quit)")
f_name = input("First name: ")
if f_name == 'q':
break
l_name = input("Last name: ")
if l_name == 'q':
break
formatted_name = get_formatted_name(f_name, l_name)
print(f"\nHello, {formatted_name}!")
