本文實例講述了Python2隨機數(shù)列生成器。分享給大家供大家參考,具體如下:
#filename:randNumber.pyimport randomwhile True: try: row=int(raw_input('Enter the rows:')) cols=int(raw_input('then Enter the cols:')) minNum=int(raw_input('then Enter the minNumber:')) maxNum=int(raw_input('then Enter the maxNumber:')) r=0 while r<row: line='' c=0 while c<cols: s=random.randint(minNum,maxNum) line+=str(s) line+=' ' c+=1 r+=1 print(line) except ValueError as err: print err
希望本文所述對大家Python程序設(shè)計有所幫助。
新聞熱點
疑難解答
圖片精選