Welcome to the Treehouse Community
Looking to learn something new?
Format of function
Why we have written new_item next to addlist What if we didn't write that.
Since this is the definition of the function, you can choose how many arguments the function should accept. If you remove the new_item variable from the definition, then your function will not take any variables as input.
In order to use new_item inside of the addlist function, it must be in those parentheses ( ). If you remove it from the definition, but try to use the function, you will receive an error.
def addlist(): print(new_item) new_item = 'apples' addlist(new_item)
The code above results in an error message: TypeError: addlist() takes 0 positional arguments but 1 was given