random_range

2018-07-19  本文已影响0人  fanbotao

# 数字范围

from randomimport choice, random

for iin range(1,10,2):

print(i)

# 随机挑选一个元素

tuple1 = (1,2,3,4,5)

list1 = ['a','b','c']

set1  = {1,2,5}

n = choice(tuple1)

print(n)

# 生成一个0-1的随机数字

num = random()

numint =int(num*100)

print(num)

print(numint)

for iin range(10):

print(i)

上一篇下一篇

猜你喜欢

热点阅读