1. Learn
  2. /
  3. Courses
  4. /
  5. Intermediate Julia

Exercise

Python functions in Julia

Now that you have imported the math package from Python in the previous exercise using PythonCall, you can begin to call functions from the package.

You have imported math using the alias pymath, so when calling functions from math, prefix the function with pymath. This makes it clear that you are using an imported Python version of the package.

Instructions

100 XP
  • Define a vector x containing the values from negative three to three in increments of one, including zero, as you normally would using Julia's square bracket syntax.
  • Use the Python function fabs in the math package to get the absolute value of the second value in x.
  • Use the Python function pow in the math package to raise the sixth value of x to the seventh value of x.