def functionCreator(txt):
def createdFunction(newTxt):
return txt + " " + newTxt
return createdFunction
print(functionCreator("hello")("world"))
# Here we define the function with a parameter
def greet(lang):
if lang == 'spanish':
print('Hola!')
elif lang == 'french':
print('Bonjour!')
else:
print('Hello!')
# Now we can call or invoke the function with different parameters
greet('spanish') # Output - Hola!
greet('french') # Output - Bonjour!
greet('english') # Output - Hello!
def greet(name, msg):
"""This function greets to
the person with the provided message"""
print("Hello", name + ', ' + msg)
greet("Monica", "Good morning!")