-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnested_f01.py
More file actions
33 lines (25 loc) · 748 Bytes
/
nested_f01.py
File metadata and controls
33 lines (25 loc) · 748 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
29
30
31
32
33
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Jun 24 10:20:56 2018
In this exercise, you will complete the definition of the inner function
inner_echo() and then call echo() a couple of times, each with a different
argument. Complete the exercise and see what the output will be!
@author: Shariful
"""
# Define echo
def echo(n):
"""Return the inner_echo function."""
# Define inner_echo
def inner_echo(word1):
"""Concatenate n copies of word1."""
echo_word = word1 * n
return echo_word
# Return inner_echo
return inner_echo
# Call echo: twice
twice = echo(2)
# Call echo: thrice
thrice = echo(3)
# Call twice() and thrice() then print
print(twice('hello'), thrice('hello'))