Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

You must login to ask a question.

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Quizzma Latest Articles

8.1.8 Citation CodeHS Answers

We thoroughly check each answer to a question to provide you with the most correct answers. Found a mistake? Tell us about it through the REPORT button at the bottom of the page. Ctrl+F (Cmd+F) will help you a lot when searching through such a large set of questions.

The most common answer is:

fill in the citation function to return the author’s name in the correct format
author_name = (“Martin”, “Luther”, “King, Jr.”)
def citation(author_name):
return (author_name[-1] + “, ” + author_name[0] + ” ” + author_name [1])
print (citation(author_name))

This function citation is meant to format the author’s name in a specific citation style, where the last name comes first, followed by a comma, and then the first and middle names. Since the author’s name is provided as a tuple author_name = (“Martin”, “Luther”, “King, Jr.”), the function should correctly handle the formatting, including the suffix “Jr.” if present.

Given the tuple, we want the output to be “King, Jr., Martin Luther.” To achieve this, considering the suffix part of the last name, the code needs to concatenate the elements of the tuple appropriately:

author_name = ("Martin", "Luther", "King, Jr.")

def citation(author_name):
    # Assuming the last element might contain suffixes like "Jr."
    return author_name[2] + ", " + author_name[0] + " " + author_name[1]

print(citation(author_name))

However, based on the initial instruction and the function implementation you provided, if you intend for the output to simply place the last name (including any suffixes) before the first name and middle initial without specifically formatting the suffix, the given function already does this correctly but just needs proper ASCII quotation marks for Python syntax:

author_name = ("Martin", "Luther", "King, Jr.")

def citation(author_name):
    return (author_name[-1] + ", " + author_name[0] + " " + author_name[1])

print(citation(author_name))

This corrected version also outputs “King, Jr., Martin Luther” assuming the last element of the tuple is treated as the entire last name. If the format “King, Martin Luther, Jr.” is preferred, you’d adjust the concatenation to include the suffix at the end properly.

Was this helpful?




Quizzma Team

Quizzma Team

The Quizzma Team is a collective of experienced educators, subject matter experts, and content developers dedicated to providing accurate and high-quality educational resources. With a diverse range of expertise across various subjects, the team collaboratively reviews, creates, and publishes content to aid in learning and self-assessment.
Each piece of content undergoes a rigorous review process to ensure accuracy, relevance, and clarity. The Quizzma Team is committed to fostering a conducive learning environment for individuals and continually strives to provide reliable and valuable educational resources on a wide array of topics. Through collaborative effort and a shared passion for education, the Quizzma Team aims to contribute positively to the broader learning community.

Related Posts

Leave a comment