Crossin的编程教室

标题: 每日一坑 取随机数 [打印本页]

作者: maxine    时间: 2016-1-5 16:49
标题: 每日一坑 取随机数
#-*- coding:utf-8 -*-
import random
n = int(raw_input('Input n:'))
m = int(raw_input('Input m:'))
print '取得m个随机数如下:'
lst = []
while len(lst) != m :
    lst.append(random.randint(1,n))
for i in lst:
    print i,





欢迎光临 Crossin的编程教室 (https://bbs.crossincode.com/) Powered by Discuz! X2.5