-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How does the function fit in? #15
Comments
It requires you to append data to hungry list and then return that list. At least that is what worked for me |
you are defining hungry_list as an empty list. The 2nd paragraph is defining append_to_list as a command to print hungry_list which is an empty list at this point. In the final part you're telling it to ad "" to that empty list. What I did was look at it as defining append_to_list(a, b). Where a is going to be a list, and b is going to whatever value that the code will append to list a. You don't need to define a or b (or in this case hungry_list and data) because their values are determined by whatever two things you put in parentheses in your test functions. |
Not sure why my code isn't working.... test_append_empty_list = [] def append_to_list(test_append_empty_list,b): append_to_list(test_append_empty_list,"list food") print(test_append_empty_list) |
jamesislike Try debugging your code in pythontutor.com When I have been writing functions, it's been useful to me to look at the examples and work backwards from there. a_list = ['pizza', 'bacon'] So when you define the function it is supposed to look at any list, a_list in the example, and add data to that list and then finally return the list. In the example's second line, the function append_to_list is called and ['pizza', 'bacon'] becomes ['pizza', 'bacon', 'hamburguer']. |
def append_to_list(hungry_list, data): |
I'm struggling on this one. What is the function supposed to invoke?
The text was updated successfully, but these errors were encountered: