源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

Python2随机数列生成器简单实例

  • 时间:2022-08-05 10:32 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:Python2随机数列生成器简单实例
本文实例讲述了Python2随机数列生成器。分享给大家供大家参考,具体如下:
#filename:randNumber.py
import random
while 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

[b]PS:这里再提供几款相关工具供大家参考使用:[/b] [b]在线随机生成个人信息数据工具: [/b][url=http://tools.jb51.net/aideddesign/rnd_userinfo]http://tools.jb51.net/aideddesign/rnd_userinfo[/url] [b]在线随机字符/随机密码生成工具: [/b][url=http://tools.jb51.net/aideddesign/rnd_password]http://tools.jb51.net/aideddesign/rnd_password[/url] [b]在线随机数字/字符串生成工具: [/b][url=http://tools.jb51.net/aideddesign/suijishu]http://tools.jb51.net/aideddesign/suijishu[/url] [b]常用电话号码在线查询: [/b][url=http://tools.jb51.net/bianmin/pub_tel]http://tools.jb51.net/bianmin/pub_tel[/url] 更多关于Python相关内容感兴趣的读者可查看本站专题:《[url=http://www.1sucai.cn/Special/942.htm]Python数学运算技巧总结[/url]》、《[url=http://www.1sucai.cn/Special/636.htm]Python字符串操作技巧汇总[/url]》、《[url=http://www.1sucai.cn/Special/788.htm]Python编码操作技巧总结[/url]》、《[url=http://www.1sucai.cn/Special/663.htm]Python数据结构与算法教程[/url]》、《[url=http://www.1sucai.cn/Special/642.htm]Python函数使用技巧总结[/url]》、《[url=http://www.1sucai.cn/Special/520.htm]Python入门与进阶经典教程[/url]》及《[url=http://www.1sucai.cn/Special/516.htm]Python文件与目录操作技巧汇总[/url]》 希望本文所述对大家Python程序设计有所帮助。
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部