7Packages & Modules

Packages and Modules in Python allow you to import extra functionality that has been developed by the community.

As an example, let's say that we want to generate a random number using the random package.

-> pip install random #Run this in terminal


import random
print(random.randint(1, 10))
Output:
A random number between 1 to 10. 
3, 1, 9 ..etc.

As an example, we could import Flask framework which would allow us to create Web Applications in Python.

Last updated