Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
Alexis Suberville1,455 Points
What's the logic of having to import "math" before being able to use the functions? Are they not readily available?
If we don't import math, it looks like it becomes an undefined value.. but what is the benefit of having that vs having all of these functions 'pre-loaded'? Thanks!
Jennifer NordellTreehouse Teacher
Hi, Alexis Suberville! The
math library is part of the base Python language, yes. But it is abstracted out into its own library. To use any of the libraries you need to import them. Math is just one of those. There are many many more including libraries to read CSV files, do basic statistics, handle data persistence, data compression and more. Your simple script would be incredibly bloated with unnecessary overhead if every library were loaded.
Here is a list of built-in libraries
Hope this helps!