Which function prints Car from the value of argument passed to it?

Hi everyone,

I’ve had some trouble understanding the code and solution to this practice question. This is from the “Analyze Data with Python” class. The question is: “What function prints Car from the value of argument passed to it?”

The link is here.

def print_arg(employee_name):

def print_name():

def print_something(number):

def print_car():

item_name = "Car"

The solution is:

def print_arg(employee_name):

Appreciate any help anyone can provide. Thanks!

Examine the one declared variable in the above code, item_name.

The operative words are, “from the value of argument passed to it.”

Now look closely at the function call that actually polls the one declared variable.

The function has a rather deceptive parameter, employee_name but if we understand parameters we can see past this. The parameter could be x or chekov for all that really matters.

Bottom line, the only function that meets the requirements is this one. Study this lesson and don’t leave until everything is clear.


Thank you for the response. I understand why the solution above works.

However, I think what I’m struggling to understand is, doesn’t the following function also satisfy the question?

def print_something(number):

Isn’t the 55 in print_something(55) considered an argument as well?

Is the string "Car" being passed into that function, and then used to control the output from print()?

No, it isn’t - so that solution doesn’t meet the criteria in the question. :slight_smile:

1 Like