Python Practice Example 50
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.4012371357Other extensions
Python 100 Examples