python 当日日期

Problem statement:

问题陈述:

There are two basketball teams (Team1 and Team2) in a school and they play some matches every day depending on their time and interest. Some days they play 3 matches, some days 2, some days 1, etc.

一所学校有两支篮球队(Team1和Team2),他们每天根据时间和兴趣参加一些比赛。 某些时候他们玩3场比赛,有些日子2,有些日子1等。

Write a python function, find_winner_of_the_day(), which accepts the name of the winner of each match and returns the name of the overall winner of the day. In case of the equal number of wins, return "Tie".

编写一个python函数find_winner_of_the_day() ,该函数接受每次比赛的获胜者的姓名,并返回当日获胜者的姓名。 如果获胜次数相等,则返回“ Tie”

Example:

例:

    Input : Team1 Team2 Team1
Output : Team1
Input : Team1 Team2 Team2 Team1 Team2
Output : Team2

Code:

码:

# Python3 program to find winner of the day
# function which accepts the name of winner
# of each match of the day and return
# winner of the day
# This function accepts variable number of arguments in a tuple
def find_winner_of_the_day(*match_tuple):
team1_count = 0
team2_count = 0
# Iterating through all team name
# present in a match tuple variable
for team_name in match_tuple :
if team_name == "Team1" :
team1_count += 1
else :
team2_count += 1
if team1_count == team2_count :
return "Tie"
elif team1_count > team2_count :
return "Team1"
else :
return "Team2"
# Driver Code
if __name__ == "__main__" :
print(find_winner_of_the_day("Team1","Team2","Team1"))
print(find_winner_of_the_day("Team1","Team2","Team1","Team2"))
print(find_winner_of_the_day("Team1","Team2","Team2","Team1","Team2"))

Output

输出量

Team1
Tie
Team2

翻译自: https://www.includehelp.com/python/find-winner-of-the-day.aspx

python 当日日期

python 当日日期_Python程序寻找当日赢家相关推荐

  1. python获取日期_python 获取日期

    python 获取日期我们需要用到time模块,比如time.strftime方法 time.strftime('%Y-%m-%d',time.localtime(time.time())) 最后用t ...

  2. python获取当前日期_Python程序获取当前日期

    python获取当前日期 In the below example – we are implementing a python program to get the current date. 在下 ...

  3. python 常用库_Python程序员解决棘手问题的常用库

    无论做为Python大牛,还是一个Python菜鸟,在编程的道路上都会遇到诸多种很棘手的问题.如下介绍的内个库是Python诸多问题解决中,最常用到的.希望这些Python的库可以帮您快速解决遇到的棘 ...

  4. python知道答案_Python程序设计基础知道章节测试答案

    Python程序设计基础知道章节测试答案 更多相关问题 cso15°cos30°+cos105°sin30°的值是()A.22B.32C.12D.1 When sugar ______ enough, ...

  5. python判断日期_python如何判断日期的合法性?

    判断日期的合法性,有两层含义,一是日期格式是否合法,二是格式合法后,其所表示的实际的那一天,是否真实存在!在python中,做这个合法性的判断,so easy!~~ 我们需要用到datetime模块中 ...

  6. python窗口化编程_python程序的窗口化

    展开全部 如果我没有理解错的话,看样子你应该不需要.net,就是自己的一个程序想要62616964757a686964616fe78988e69d8331333264646530个图形界面而已. 我自 ...

  7. python pandas 日期_python+pandas+时间、日期以及时间序列处理方法

    python+pandas+时间.日期以及时间序列处理方法 先简单的了解下日期和时间数据类型及工具 python标准库包含于日期(date)和时间(time)数据的数据类型,datetime.time ...

  8. 简述python执行原理_Python程序的执行原理(1)(2)

    Python程序的执行原理(1)(2) 1. 过程概述 Python先把代码(.py文件)编译成字节码,交给字节码虚拟机,然后虚拟机一条一条执行字节码指令,从而完成程序的执行. 2. 字节码 字节码在 ...

  9. python诞生日期_Python中的时间与日期

    本文简要介绍datetime,time模块的简要用法. datetime模块 datetime模块主要有四个主要的对象. date 处理年.月.日 time处理时.分.秒.微秒 datetime处理日 ...

最新文章

  1. 解决:VS 2005/2008 中 fstream 不能处理带有中文路径的问题
  2. 2003 64位系统 IIS6 32位模式运行
  3. 别具一格的HAO3GP整站源码花坛
  4. F - 上升子序列-超详细注释版
  5. C语言和设计模式(之原型模式)
  6. Hibernate复习笔记
  7. UVA10267 Graphical Editor【模拟】
  8. Java 12字符串方法
  9. 联调测试是什么意思_阿里开源 KT Connnect,轻量级云原生测试环境治理平台来啦!...
  10. 扩展整数poj 1061 青蛙的约会 扩展欧几里得
  11. storm无损 the wolven_TheFatRat,Maisy Kay-The Storm[FLAC格式]
  12. dedecms如何做中英文网站?
  13. Excel中的数字转文本和文本转数字
  14. win+L 锁屏快捷键 失效
  15. 车载网络信号的编码方式
  16. Mac无法读取外置硬盘怎么办?
  17. 【C++】Placement New
  18. 2016年蓝桥杯A组 第九题 密码脱落
  19. 在即将欢度春节的日子里,七大姑八大姨们问我程序员是啥子,我应该怎么介绍?
  20. 卸载Symantec Endpoint Protection, 无需密码的卸载方法

热门文章

  1. 潜流式湿地计算_人工湿地计算书
  2. python3.6安装ipython_centos6.5下安装python3.6、pip、ipython
  3. mysql异步查询 java_基于 mysql 异步驱动的非阻塞 Mybatis
  4. linux中touch命令的作用,Linux中touch命令的作用是什么
  5. python删除列表一段元素_Python基础--list列表删除元素
  6. android手机微信收藏功能实现,Android模仿微信收藏文件的标签处理功能
  7. weblogic忘记console密码
  8. Ubuntu下面apache2安装
  9. AI工程师职业规划和学习路线完整版
  10. [3/21]Windows Server 2008时钟方面的改进展示