Python Practice Example 50

Python 100例Python 100 Examples

Problem:Output a random number.

Program analysis:Use the random module.

Program source code:

Example

#!/usr/bin/python # -*- coding: UTF-8 -*- import random # Generate a random number between 10 and 20 print (random.uniform(10, 20))

The output of the above example is:

14.4012371357

Python 100例Python 100 Examples

Other extensions