返回列表 發帖

亂數 (三) - shuffle()

  1. import random as r
  2. l=[]
  3. for i in range(10):
  4.     l.append(i)
  5. print(l)
  6. r.shuffle(l)
  7. print(l)
複製代碼

  1. import random as eeeeeeeeeeeeeeeeeeee
  2. l = []
  3. for i in range(10):
  4.     l.append(i)
  5. print(l)
  6. eeeeeeeeeeeeeeeeeeee.shuffle(l)
  7. print(l)
複製代碼

TOP

  1. from random import *
  2. l=[]
  3. for i in range(10):
  4.     l.append(i)
  5. print(l)
  6. shuffle(l)
  7. print(l)
複製代碼

TOP

返回列表