日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

python 当日日期_Python程序寻找当日赢家

發布時間:2025/3/11 python 36 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python 当日日期_Python程序寻找当日赢家 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

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 Team1Output : Team1Input : Team1 Team2 Team2 Team1 Team2Output : 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 = 0team2_count = 0# Iterating through all team name # present in a match tuple variablefor team_name in match_tuple :if team_name == "Team1" :team1_count += 1else :team2_count += 1if 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程序寻找当日赢家的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。