当前位置: 首页 > wzjs >正文

网站怎样做有利于seo佛山网站seo

网站怎样做有利于seo,佛山网站seo,武汉新公司做网站,摄影网站知乎题目 当输入单人赢球概率不在1到0之内,提示重新输入每局比赛一方比分大于21,且与另一方分差至少为2,则该场胜利者为得分高者,否者得分高者仅为该局胜利者每场比赛三局两胜,先赢两场为胜利者 代码 import random# 判…

题目

  1. 当输入单人赢球概率不在1到0之内,提示重新输入
  2. 每局比赛一方比分大于21,且与另一方分差至少为2,则该场胜利者为得分高者,否者得分高者仅为该局胜利者
  3. 每场比赛三局两胜,先赢两场为胜利者

代码

import random# 判断是否为数字
def is_number(v):if v.isdigit():return float(v)else:try:if float(v):return float(v)else:return Falseexcept ValueError:return False# 获取单人成绩 随机数    
def getr(p):s = random.triangular(0, p)*100s = round(s)return s# 获取单局结果
def def_result_item(ap,bp):a_s,b_s = getr(ap),getr(bp)# a_s,b_s = 7,11max_s = 21s_list = {"a":a_s,"b":b_s}ss_list = sorted(s_list.items(), key=lambda x:x[1], reverse=True)k0,v0 = ss_list[0]k1,v1 = ss_list[1]r = Falseif v1!=v0:if v0>=21 and v0-v1>=2:r=k0else:print(ss_list)return Falsedata = {"list":ss_list,"r":r}return data#获取单场结果
def get_result(ap,bp):last_r = Falseresult_list = {}result = ""result_list =[]for i in range(1,3):data = def_result_item(ap,bp)if not data:continuer = data.get("r")list_v = data.get("list")result_data = {"index":i,'r':r,"list":list_v}result_list.append(result_data)if r:last_r = rbreak;k,v= list_v[0]result += k+","ca = result.count('a')cb = result.count('b')if ca==2:last_r =  'a'breakif cb==2:last_r = 'b'breakdata = {"list":result_list,"r":last_r}return data#调用    
def get_inputs(times):pa = input("输入单球获胜概率")while True:pa=is_number(pa)if pa:if not (pa>0 and pa<1):pa = input("输入错误,请重新输入")else:breakelse:pa = input("输入数字,请重新输入")pb=round(1-pa,2)print("a p:{0} b p:{1} itmes:{2}".format(pa,pb,times))ra = 0rb = 0for i in range(0,times):print("time:{0}".format(i))result = get_result(pa,pb)r =  result.get("r")list_v = result.get("list")print(list_v)if r =="a":ra+=1if r =="b":rb+=1print("ra:{0} tb:{1}".format(ra,rb))#比赛50次
get_inputs(50)

输出

输入单球获胜概率 aa
输入数字,请重新输入 0.4
a p:0.4 b p:0.6 itmes:50
time:0
[{'index': 1, 'r': 'b', 'list': [('b', 40), ('a', 24)]}]
time:1
[{'index': 1, 'r': 'a', 'list': [('a', 37), ('b', 4)]}]
time:2
[{'index': 1, 'r': 'b', 'list': [('b', 27), ('a', 13)]}]
time:3
[{'index': 1, 'r': False, 'list': [('b', 18), ('a', 15)]}, {'index': 2, 'r': 'a', 'list': [('a', 34), ('b', 22)]}]
time:4
[{'index': 1, 'r': 'b', 'list': [('b', 46), ('a', 36)]}]
time:5
[{'index': 1, 'r': 'a', 'list': [('a', 23), ('b', 16)]}]
time:6
[{'index': 1, 'r': 'b', 'list': [('b', 38), ('a', 19)]}]
time:7
[{'index': 1, 'r': 'b', 'list': [('b', 23), ('a', 13)]}]
time:8
[{'index': 1, 'r': 'b', 'list': [('b', 32), ('a', 22)]}]
time:9
[{'index': 1, 'r': 'b', 'list': [('b', 33), ('a', 30)]}]
time:10
[{'index': 1, 'r': False, 'list': [('b', 20), ('a', 18)]}, {'index': 2, 'r': 'b', 'list': [('b', 51), ('a', 10)]}]
time:11
[{'index': 1, 'r': 'b', 'list': [('b', 40), ('a', 22)]}]
time:12
[{'index': 1, 'r': 'b', 'list': [('b', 41), ('a', 5)]}]
time:13
[{'index': 1, 'r': 'b', 'list': [('b', 25), ('a', 18)]}]
time:14
[{'index': 1, 'r': False, 'list': [('a', 17), ('b', 11)]}, {'index': 2, 'r': 'b', 'list': [('b', 40), ('a', 8)]}]
time:15
[{'index': 1, 'r': 'a', 'list': [('a', 27), ('b', 17)]}]
time:16
[('a', 33), ('b', 33)]
[{'index': 2, 'r': 'a', 'list': [('a', 26), ('b', 22)]}]
time:17
[{'index': 1, 'r': 'b', 'list': [('b', 34), ('a', 23)]}]
time:18
[{'index': 1, 'r': 'a', 'list': [('a', 22), ('b', 7)]}]
time:19
[{'index': 1, 'r': 'a', 'list': [('a', 28), ('b', 25)]}]
time:20
[{'index': 1, 'r': 'b', 'list': [('b', 27), ('a', 10)]}]
time:21
[{'index': 1, 'r': 'b', 'list': [('b', 34), ('a', 11)]}]
time:22
[('a', 28), ('b', 28)]
[{'index': 2, 'r': 'b', 'list': [('b', 43), ('a', 6)]}]
time:23
[{'index': 1, 'r': 'b', 'list': [('b', 24), ('a', 17)]}]
time:24
[{'index': 1, 'r': 'b', 'list': [('b', 39), ('a', 23)]}]
time:25
[{'index': 1, 'r': 'b', 'list': [('b', 46), ('a', 25)]}]
time:26
[{'index': 1, 'r': 'b', 'list': [('b', 44), ('a', 11)]}]
time:27
[{'index': 1, 'r': 'b', 'list': [('b', 44), ('a', 6)]}]
time:28
[{'index': 1, 'r': 'b', 'list': [('b', 48), ('a', 8)]}]
time:29
[{'index': 1, 'r': 'b', 'list': [('b', 41), ('a', 32)]}]
time:30
[{'index': 1, 'r': 'b', 'list': [('b', 30), ('a', 10)]}]
time:31
[{'index': 1, 'r': 'b', 'list': [('b', 39), ('a', 14)]}]
time:32
[{'index': 1, 'r': 'b', 'list': [('b', 46), ('a', 17)]}]
time:33
[{'index': 1, 'r': 'a', 'list': [('a', 34), ('b', 6)]}]
time:34
[{'index': 1, 'r': 'b', 'list': [('b', 34), ('a', 16)]}]
time:35
[{'index': 1, 'r': 'b', 'list': [('b', 28), ('a', 16)]}]
time:36
[{'index': 1, 'r': 'b', 'list': [('b', 49), ('a', 33)]}]
time:37
[{'index': 1, 'r': 'b', 'list': [('b', 31), ('a', 5)]}]
time:38
[{'index': 1, 'r': 'b', 'list': [('b', 24), ('a', 11)]}]
time:39
[{'index': 1, 'r': 'a', 'list': [('a', 22), ('b', 17)]}]
time:40
[{'index': 1, 'r': 'b', 'list': [('b', 28), ('a', 20)]}]
time:41
[{'index': 1, 'r': 'b', 'list': [('b', 45), ('a', 20)]}]
time:42
[{'index': 1, 'r': 'b', 'list': [('b', 24), ('a', 18)]}]
time:43
[{'index': 1, 'r': 'b', 'list': [('b', 46), ('a', 27)]}]
time:44
[{'index': 1, 'r': False, 'list': [('a', 11), ('b', 8)]}, {'index': 2, 'r': 'b', 'list': [('b', 34), ('a', 13)]}]
time:45
[{'index': 1, 'r': 'a', 'list': [('a', 29), ('b', 26)]}]
time:46
[{'index': 1, 'r': 'a', 'list': [('a', 21), ('b', 15)]}]
time:47
[{'index': 1, 'r': 'b', 'list': [('b', 29), ('a', 19)]}]
time:48
[{'index': 1, 'r': 'b', 'list': [('b', 41), ('a', 34)]}]
time:49
[{'index': 1, 'r': False, 'list': [('a', 20), ('b', 19)]}, {'index': 2, 'r': False, 'list': [('b', 16), ('a', 14)]}]
ra:11 tb:38

http://www.dtcms.com/wzjs/77098.html

相关文章:

  • 做网站优化选阿里巴巴还是百度电商大数据查询平台
  • 网络营销工具的定义移动建站优化
  • wordpress配置百度云cdn加速福州seo视频
  • 网站关键词库如何做怎样制作网页
  • 莆田哪里有网站开发今日百度搜索风云榜
  • 哈尔滨市住房和城乡建设局网站百度推广优化师培训
  • wordpress页面url设置抖音seo教程
  • 如果只做p2p种子搜索网站国内新闻最新消息今天
  • 江门恒阳网站建设百度百家号怎么赚钱
  • 网站建设 浏览器兼容seo免费培训视频
  • asp做静态网站如何推广seo
  • 专业做私募网站外链工厂 外链
  • 铜仁建设公司网站上海网站制作开发
  • 深圳企业网站建设怎么做最近新闻摘抄50字
  • 黑龙江省建设厅网站的电话最新热点新闻事件素材
  • 手机app设计网站建设排行榜百度
  • 网站内容怎么做长春seo公司哪家好
  • 选择网站开发公司的标准seo实战培训课程
  • 网站首页布局修改识图
  • 做心悦腾龙光环的网站是什么建立网站要多少钱一年
  • 做h5网站用什么个人网站建设
  • WordPress做推广win优化大师有用吗
  • 深圳外贸网站建设工作室做网站优化的公司
  • 哪里可以免费设计装修房子武汉seo优
  • 怎样做网站维护制作网站的步骤
  • wordpress ajax 文件上传win10最强性能优化设置
  • 云服务器防御青岛seo建站
  • 公司网站建设成本临沂百度seo
  • 中国党风廉政建设网站推广文案怎么写
  • 衢州酷网站制作凡科建站怎么建网站