-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnested_f00.py
More file actions
28 lines (22 loc) · 775 Bytes
/
nested_f00.py
File metadata and controls
28 lines (22 loc) · 775 Bytes
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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Jun 24 10:14:37 2018
In this exercise, inside a function three_shouts(), you will define a nested
function inner() that concatenates a string object with !!!. three_shouts()
then returns a tuple of three elements, each a string concatenated with !!!
using inner(). Go for it!
@author: Shariful
"""
# Define three_shouts
def three_shouts(word1, word2, word3):
"""Returns a tuple of strings
concatenated with '!!!'."""
# Define inner
def inner(word):
"""Returns a string concatenated with '!!!'."""
return word + '!!!'
# Return a tuple of strings
return (inner(word1), inner(word2), inner(word3))
# Call three_shouts() and print
print(three_shouts('a', 'b', 'c'))