Python Functions, Packing, and Unpacking Introduction to Functions Defining a Function

I am used to seeing: print(favorite_movie) not print_favorite_movie() Which is the more widely used convention?

Just wondering how old this video is

2 Answers

Hi Suzanne

In this video with print_favorite_movie() the teacher is calling the function. As she explains in the next video this is a good name for a function because it accurately describes what the code inside is doing. When she calls the function the output is 'Mean Girls'.

marin stefan daniel
marin stefan daniel
1,734 Points

< print(favorite_movie) > is a command that prints whatever is stored into 'favorite_movie' . it calls a function called 'print' which comes as built in an. < print_favorite_movie() > is a command that calls (executes) a previously defined function (by the user probably ..certainly not built in ) called ,in this case, 'print_favorite_movie'