The help() function

How does one know how to use a particular function? Well, using the help function. Execute the code below to see the output of the help function.

As you can see, help is yet another Python function. It gets as argument a code element and it returns as output the help documentation of that element. As a programmer, you can read through that output to understand how to use the pow function. For example, you will see that it gets two arguments, x, and y, so the base and the exponent. You will also see that there is also a third z parameter there. That is equal to None which means z is an optional argument. That means you don't have to pass a third argument when you are using pow but you can pass a third one if you like. Let's try to do that in the next lecture.

Since you are here, try experimenting with the help function a little bit to get familiar with it. Some things you can try are:

  • Change pow to max to get the documentation of max.
  • Change pow to print to get the documentation of print.

Next Lecture
Recommended Course

Python Mega Course: Learn Python in 60 Days, Build 20 Apps
Learn Python on Udemy completely in 60 days or less by building 20 real-world applications from web development to data science.