Which of the following is the correct way to begin a program that uses a function from Python's Math Module? def main(math): from math import * input(math) print(math)
am i right with B?
@smokeybrown
Yup, just like Chloeisdum said, you got it! The other options use math as a parameter for various functions, but only the second option "from math import *" would give your code access to Python's math module
Like your instructor has probably explained, modules are kind of like tool kits that we can access to make writing code easier. Modules (sometimes called "libraries") give you access to classes and functions that can do specialized things such as special calculations or drawing or many other things. To access these modules, you have to use the "import" instruction, just like in the answer choice. You can take a specific tool from the toolbox, like from math import pow() or you can get access to the entire toolbox using the *, which just imports everything, as seen in the answer choice
Yeah, thank you
Nice, good work figuring that out :)
Join our real-time social learning platform and learn together with your friends!