fork download
  1. #PF-Exer-28
  2. def find_winner_of_the_day(*match_tuple):
  3. #Remove pass and write the logic here
  4. count = 0
  5. str = ""
  6. teams = ['Team1','Team2']
  7. freq = {}
  8. max = -999999
  9. for i in teams:
  10. freq[i]=0
  11. for i in match_tuple :
  12. if i in teams:
  13. freq[i] += 1
  14. for k,v in freq.items():
  15. if v > max :
  16. max = v
  17. flag = 0
  18. for k,v in freq.items():
  19. if v == max and flag == 0:
  20. req = k
  21. flag = 1
  22. elif v == max and flag == 1 :
  23. return "Tie"
  24. else :
  25. continue
  26.  
  27. #print(req)
  28. return req
  29.  
  30. #Invoke the function with each of the print statements given below
  31. print(find_winner_of_the_day("Team1","Team2"))
  32. print(find_winner_of_the_day("Team1","Team2","Team1","Team2"))
  33.  
Success #stdin #stdout 0.02s 28384KB
stdin
Standard input is empty
stdout
Tie
Tie