Python 練習實例50

Python 100例 Python 100例

題目:輸出一個亂數。

程式分析:使用 random 模組。

程式源代碼:

實例

#!/usr/bin/python # -*- coding: UTF-8 -*- import random #生成 10 到 20 之間的亂數 print random.uniform(10, 20)

以上實例輸出結果為:

14.4012371357

Python 100例 Python 100例