Showing posts with the label Built-In Modules

Python Built-In Modules - Examples

Built-in modules are part of the Python programming language and comes with the Python distribution. A built-in module can be used directly in a Python program without any installation or setup. These modules simplify the development process by allowing the developers to use the pre-defined functions and classes for routine work, code reuse, and productivity. Some examples of built-ins are math, random, json, os datetime, and sys. Let’s take a look at a Python code example of some of the built-in module and how you can use it in your Python code. random module The random module is responsible for generating random numbers. The main functions of the random module are: random():  generates a random number in the range of 0.0 and 1.0 randint():  returns a random number within a given range randrange(): returns a random number from the given range of numbers shuffle(): shuffles the list choice(): returns a random list element The random floating point number between 0.0 and 1.0 is the resu