Get startedGet started for free

Functions with multiple parameters

Hugo discussed the use of multiple parameters in defining functions in the last lecture. You are now going to use what you've learned to modify the shout() function further. Here, you will modify shout() to accept two arguments. Parts of the function shout(), which you wrote earlier, are shown.

This exercise is part of the course

Introduction to Functions in Python

View Course

Exercise instructions

  • Modify the function header such that it accepts two parameters, word1 and word2, in that order.
  • Concatenate each of word1 and word2 with '!!!' and assign to shout1 and shout2, respectively.
  • Concatenate shout1 and shout2 together, in that order, and assign to new_shout.
  • Pass the strings 'congratulations' and 'you', in that order, to a call to shout(). Assign the return value to yell.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Define shout with parameters word1 and word2
def shout(____, ____):
    """Concatenate strings with three exclamation marks"""
    # Concatenate word1 with '!!!': shout1
    
    
    # Concatenate word2 with '!!!': shout2
    
    
    # Concatenate shout1 with shout2: new_shout
    

    # Return new_shout
    return new_shout

# Pass 'congratulations' and 'you' to shout(): yell


# Print yell
print(yell)
Edit and Run Code