13/13


#1


what is the sample answer for this section? my code is not printing anything but there is the green tick ???


#2

By default, a function returns None at the end of the function. If we want to return something else at the end of the function, we can use the return keyword.

Given return is the last thing a function does, when a return keyword is reached, the function ends

so the print statement you put is never reached, plus, for a function to execute, you need to call it. Plus, if you want to print the returned result, put a print statement before the function call


#3

so if i want the function to print the total for the shopping_list, do i add in print compute_bill(shopping_list) right before return total?


#4


i did this and it worked. i think


#5

this is the better approach, by putting print statement before the function call, you print the returned result


#6

what is function call? i m kinda getting confused with all these terms = =


#7

line 26 in your code. The function call executes the function.

functions are sort of like task lists, a set of instructions which need doing but not right now, maybe later, or not at all.

the function call is what triggers the function (going about doing the task lists)

example:

# function deceleration 
def example():
    print "hello world"

# function call
example()

you can recognize the function call by its matching function name, but without the def keyword

you have used many function calls already at this point, like len(). So someone defined a function within python somewhere, which gives you the length.


#8

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.