-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Expand file tree
/
Copy pathfunctions-with-multiple-parameters.py
More file actions
36 lines (29 loc) · 1.24 KB
/
functions-with-multiple-parameters.py
File metadata and controls
36 lines (29 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
'''
Functions with multiple parameters
100xp
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.
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.
'''
# Define shout with parameters word1 and word2
def shout(word1, word2):
"""Concatenate strings with three exclamation marks"""
# Concatenate word1 with '!!!': shout1
shout1 = word1 + '!!!'
# Concatenate word2 with '!!!': shout2
shout2 = word2 + '!!!'
# Concatenate shout1 with shout2: new_shout
new_shout = shout1 + shout2
# Return new_shout
return new_shout
# Pass 'congratulations' and 'you' to shout(): yell
yell = shout('congratulations', 'you')
# Print yell
print(yell)