How to use a library?

--Originally published at codemathblog.wordpress.com

A library is a package that comes with every programming language when you install it, this has files inside, they are called “Libraries” and when you want to do something different than the common things like print, input or output, when you want to do something more complex, you use those libraries.

An example is a math operation, you can do the basic ones without any library, you can do addition, substraction, divisions and multiplications. But what happens if I want to get the factorial of a number?
Maybe I can do an operation, use if’s and loops to do the process, or maybe i can use the math function that gives me the factorial of x number?

So, a library is a little help that makes our life easy when coding.

At this page we can find all the libraries python has:
https://docs.python.org/3/library/

If you want to import a library just use the phrase “import” and the name of the library:import

And then you are able to do the operations you want inside that library? look at the python page i let you above, you will find there all the things you can do

factorial

This functions should give us the factorial of 8, lets try it:

codigo

40320 is the factorial of 8, amazing!

If you want more information about it I let you this video, it will be useful:

 

And for your fun, i let you a good ones and useful libraries:

http://www.infoworld.com/article/3008915/application-development/6-python-libraries-every-programmer-will-love.html

Happy programming!  #TC101 #PYTHON #RABBIT