Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Python Exercise Example 50

Python Exercise Example 50

Python 100 Examples 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 Examples Python 100 Examples