Ask your own question, for FREE!
Computer Science 7 Online
Gucchi:

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)

Gucchi:

am i right with B?

Gucchi:

@smokeybrown

Chloeisdum:

@gucchi wrote:
am i right with B?
You are correct

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

SmokeyBrown:

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

Gucchi:

Yeah, thank you

SmokeyBrown:

Nice, good work figuring that out :)

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!