Library
A library is a collection of pre-written code you can import and use in your own program, so you do not have to build common features from scratch.
General Programming
Libraries provide ready-made functions for tasks like math, dates, or HTTP requests. You stay in control and call the library when you need it.
Examples
Python
import random
print(random.choice(["heads", "tails"]))Output:
tails