Tag: library

Import Function

Python is a general purpose language which means that it can be used to solve many different tasks. However Python does not have a command for every single eventuality. So programmers have created document with lots of different functions, these are called module libraries.

The import command is used to import module libraries into python programs.

dice

The random module stores a number of functions, to get access to the function we want we must first import random then use dot notation to specify the function we want to call. So random.randint calls the randint function from the random module library we imported previously.

There are libraries to do many things and they all should come with documentation to make them easy to use. Like all python programs they are open source so you can have a look inside to see how they work. Here are some example