1.1. Exercises

Importing packages

Importing a Package Function

Importing Packages… Again

Instructions:
Running a coding exercise for the first time could take a bit of time for everything to load. Be patient, it could take a few minutes.

When you see ____ in a coding exercise, replace it with what you assume to be the correct code. Run it and see if you obtain the desired output. Submit your code to validate if you were correct.

Make sure you remove the hash (#) symbol in the coding portions of this question. We have commented them so that the line won’t execute and you can test your code after each step.

Ok, so we’ve seen this numpy package, let’s actually load in one of the functions and use it! If you are wondering what this package does, don’t worry, you’ll learn more of this in the next module. numpy has a function called power().

Tasks:

  • Import the power() function from the numpy package.
  • Use the power() function to find 7 to the power of 5 and save it in an object named power7_5 - you may want to use ?power to see what arguments the function requires.
  • Display your results.
Hint 1
  • Are you using power(7, 5)?
  • Are you importing using from?
Fully worked solution: