M2) Concatenating Words

In Figure 1, we have several versions of a Python function that concatenates two words passed as arguments and returns the concatenated result.

def concatenate(word1, word2):
    result = word1 + word2
(a)
def concatenate(word1, word2):
    return word1 + word2
(b)
def concatenate(word1, word2):
    return
    return word1 + word2
(c)
def concatenate(word1, word2):
    # return word1 + word2
    return
(d)
Figure 1: Alternatives for the function concatenate (Question 1).

Choose the correct version of the function concatenate that concatenates two words passed as arguments and returns the concatenated result:

TipOperator + in Python

The + operator concatenates strings in Python. For example, if word1 is "data" and word2 is "base", the expression word1 + word2 produces "database".