[Student query] Why do we import libraries/modules such as Numpy and Matplotlib into Python?

When we are programming, there are often tasks that as humans we find relatively easy to do, for example, to draw a sine graph. We would simply draw the x and y axes and draw a period or two of the wave from our memory of what it looks like.To do this in a programming language such as Python is a lot more complicated, and requires manipulation of matrices and more complicated mathematical formulae to describe the sine wave.These libraries and modules give us pre-coded implementations of these common functions that are easier and more intuitive to use, allowing us to focus on the functionality of the program rather than having to tackle these low-level issues directly ourselves.

JR

Related Python Mentoring answers

All answers ▸

Using the shared code editor, write a recursive function for calculating a factorial of an input parameter.


Write a function that takes a list of numbers as input, and outputs the average of the numbers. The function should catch any errors.


Manually implement a function that finds the smallest value in a list of integers and print it.


How do I use format python code?