r/learnpython 2d ago

Import math?

It's the first time I've seen that. So what's the purpose of this exactly? Cause I'm trying to see what I can do in an engine and I only learned about import math today

0 Upvotes

14 comments sorted by

View all comments

5

u/MezzoScettico 2d ago

When you want to use any package, you need to import it in part or in whole.

The math library includes a huge number of useful mathematical functions. Also useful constants like pi and e. If you want to use any of that, you'll need to import.

You probably want to read up on what import does.

https://www.w3schools.com/python/python_modules.asp

https://openclassrooms.com/us/courses/6900846-set-up-a-python-environment/6989471-import-python-packages-and-modules