Hi,
I coded solution for https://www.codechef.com/problems/COOK82A using python. And all test cases seems to work perfectly fine in IDE. However, on submission my code is failing. I am suspecting it to be an issue with output. Can someone please help in this regard?

Here is my code…

``````def accept_input():
no_of_test_cases= int(input())
if no_of_test_cases>500:
exit(10)
teamBarcelona = []
teamMalaga = []
teamEibar = []
result = []
def whereDoILand(ip):
print(ip)
if ip[0] == "Barcelona" and int(ip[1])<=20:
teamBarcelona.append(ip)
elif ip[0] == "Malaga" and int(ip[1])<=20:
teamMalaga.append(ip)
elif ip[0] == "RealMadrid" and int(ip[1])<=20:
elif ip[0] == "Eibar" and int(ip[1])<=20:
teamEibar.append(ip)

def whoWonTheGame(idx):
result.append("Barcelona")

for i in range(0,no_of_test_cases):
ip = input()
whereDoILand(ip.split(" "))
ip = input()
whereDoILand(ip.split(" "))
ip = input()
whereDoILand(ip.split(" "))
ip = input()
whereDoILand(ip.split(" "))

for i in range(0,no_of_test_cases):
whoWonTheGame(i)

return result

result=accept_input()
for winner in result:
print(winner)``````
1 Like

Hey there. I just ran your code on the online IDE. When the input is :

`````` 2
Barcelona 2
Malaga 1
Eibar 0
Malaga 3
Barcelona 8
Eibar 6
``````

Your program gives the output :

``````['Barcelona', '2']
['Malaga', '1']
['Eibar', '0']
['Malaga', '3']
['Barcelona', '8']
['Eibar', '6']
``````RealMadrid