As I said before, I am learning python and have come across yet another exercise that I can not quite complete.
This is what it says:
In this exercise you'll use an existing function, and while adding your own create a fully functional program.
1. Add a function named list_benefits()- that returns the following list of strings: "More organized code", "More readable code", "Easier code reuse", "Allowing programmers to share and connect code together"
2. Add a function named build_sentence(info) which receives a single argument containing a string and returns a sentence starting with the given string and ending with the string " is a benefit of functions!"
3. Run and see all the functions work together!
This is what they give you in the code box to start out with:
#Add your functions here (before the existing functions)
def name_the_benefits_of_functions():
list_of_benefits = list_benefits()
for benefit in list_of_benefits:
print build_sentence(benefit)
name_the_benefits_of_functions()
This is what I have so far:
#Add your functions here (before the existing functions)
def list_benefits(a, b, c, d):
return a, b, c, d
def name_the_benefits_of_functions():
list_of_benefits = list_benefits("More organized code", "More readable code", "Easier code reuse", "Allowing programmers to share and connect code together")
for benefit in list_of_benefits:
def build_sentence(info):
return list_benefits, "is a benefit of functions!"
print build_sentence(benefit)
name_the_benefits_of_functions()
It runs, but this is the outcome:
(<function list_benefits at 0x17133e3cd09ecd08>, 'is a benefit of functions!')
(<function list_benefits at 0x17133e3cd09ecd08>, 'is a benefit of functions!')
(<function list_benefits at 0x17133e3cd09ecd08>, 'is a benefit of functions!')
(<function list_benefits at 0x17133e3cd09ecd08>, 'is a benefit of functions!')