Imported code

In the code we have been referring to so far, we did not explain the first line yet. 

In the first line, we are importing the pyplot object from the matplotlib library.

👉Libraries are collections of Python scripts that contain Python code.

The code that defines the pyplot object resides somewhere in the matplotlib library scripts. Other code such as print and max are directly available in the interpreter, so we can use them directly without having to import anything. This design choice of Python that leaves out code in libraries helps run code faster without overloading the interpreter with every possible code. The interpreter has available only heavily used code. The good news is Python has a very wide range of libraries that can accomplish almost anything you can imagine. All you need to do is import the code, and learn how to use the code of that library by referring to the online documentation of that library. The docs of matplotlib can be found here: https://matplotlib.org/

But how can you know which library to use?

Well, that can be easily solved with some basic internet research. You can google, for example, "how to do data visualization in Python" and you will see that many websites or community forums will suggest to use matplotlib. 
 

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.