Session Ready
Exercise

How to use Python libraries?

First of all - great progress! You now know some of the important data structures in Python.

Let's take another step ahead in our journey to learn Python, by getting acquainted with some useful libraries. The first step is to learn to import them into your environment. There are several ways of doing so in Python:

import math as m

from math import *

In the first manner, we have defined an alias m to library math. We can now use various functions from math library (e.g. factorial) by referencing it using the alias m.factorial().

In the second manner, you have imported the entire name space in math i.e. you can directly use factorial() without referring to math.

Following are a list of libraries, you will need for any scientific computations and data analysis:

  • Numpy
  • Scipy
  • Pandas
  • Matplotlib
  • Scikit Learn
Which of the following is a valid import statement for below code?
print (factorial(5))
Instructions
50 XP
Possible Answers