random.sample 在 Skulpt 中?
random.sample in Skulpt?
我想使用 Skulpt 生成一个由 0 到 50 范围内的 5 个数字组成的随机列表。这是我使用的代码:
import random
print(random.sample(range(50), 5))
但它没有 运行。
有什么建议吗?
我不知道为什么没有 :) 但现在有了:
➜ skulpt git:(master) ✗ ./m run rand.py
[40, 44, 23, 36, 42]
-----
➜ skulpt git:(master) ✗ cat rand.py
import random
print(random.sample(range(50), 5))
我想使用 Skulpt 生成一个由 0 到 50 范围内的 5 个数字组成的随机列表。这是我使用的代码:
import random
print(random.sample(range(50), 5))
但它没有 运行。
有什么建议吗?
我不知道为什么没有 :) 但现在有了:
➜ skulpt git:(master) ✗ ./m run rand.py
[40, 44, 23, 36, 42]
-----
➜ skulpt git:(master) ✗ cat rand.py
import random
print(random.sample(range(50), 5))