def check_fair(l):
if len(set(l[:3])) == len(set(l[3:])):
for i in range(3):
if l[:3].index(min(l[:3])) == l[3:].index(min(l[3:])):
l[:3].pop(l[:3].index(min(l[:3])))
l[3:].pop(l[3:].index(min(l[3:])))
else:
return "NOT FAIR"
return "FAIR"
else:
return "NOT FAIR"
check = list()
for i in range(int(input())):
l = list(map(int, input().split()))
check.append(check_fair(l))
print(*check, sep="\n")
When i am running below code in dev c++ ,i am gettting correct answer.but on submitting it is showing wrong answer.can anyone tell me whats wrong in my code? #include <stdio.h>
int max(int q[])
{
int max=0,i;
PSA - if you’re going to post your code and ask for help, please ensure that it is formatted correctly - use the “Preformatted text” (</>), or paste a link to your solution!
@author: Arijeet Mukherjee
‘’’
print("Please enter the number of tries you want to test between 1 to 1000 :\n ")
n=int(input("Enter now : "))
while(n<1 or n >1000):
print(“pls enter tries bw 1 and 1000 \n”)
n=int(input(“Enter now :”))
print(n)
lis=[]
def eid(lis):
if(lis[0]==lis[1]==lis[2]):
if(lis[3]==lis[4]==lis[5]):
print(“FAIR”)
else:
print(“NOT FAIR”)
i=0
while (i<n):
print(“Enter age in between 1 and 17 only”)
age1=int(input(“Enter the age of first child :”))
age2=int(input(“Enter the age of second child :”))
age3=int(input(“Enter the age of third child :”))
while(age1<1 or age1 >17):
print(“Enter age of 1st child age between 1 and 17 only : \n”)
age1=int(input(“Enter the age of first child :”))
while(age2<1 or age2 >17):
print(“Enter age of 2nd child age between 1 and 17 only : \n”)
age1=int(input(“Enter the age of second child :”))
while(age3<1 or age3>17):
print(“Enter age of 3rd child age between 1 and 17 only : \n”)
age1=int(input(“Enter the age of third child :”))
print(“Enter the amount in between 1 and 100 only \n”)
mon1=int(input(“Enter the amount of money for first child”))
while(mon1<1 or mon1>100):
print(“Enter money in bw 1 and 100 pls : \n”)
mon1=int(input(“Enter the money of child first :”))
mon2=int(input(“Enter the amount of money for second child”))
while(mon2<1 or mon2>100):
print(“Enter money in bw 1 and 100 pls : \n”)
mon2=int(input(“Enter the money of second child :”))
mon3=int(input(“Enter the amount of money for third child”))
while(mon3<1 or mon3>100):
print(“Enter money in bw 1 and 100 pls : \n”)
mon3=int(input(“Enter the money of third child :”))
lis.append(age1)
lis.append(age2)
lis.append(age3)
lis.append(mon1)
lis.append(mon2)
lis.append(mon3)
print(lis)
eid(lis)
i=i+1
def check_fair(l):
if len(set(l[:3])) == len(set(l[3:])):
for i in range(3):
if l[:3].index(min(l[:3])) == l[3:].index(min(l[3:])):
l[:3].pop(l[:3].index(min(l[:3])))
l[3:].pop(l[3:].index(min(l[3:])))
else:
return "NOT FAIR"
return "FAIR"
else:
return "NOT FAIR"
check = list()
for i in range(int(input())):
#l.append(list(map(int, input().split())))
l = list(map(int, input().split()))
check.append(check_fair(l))
#print(check_fair(l))
print(*check, sep="\n")
Now, what’s wrong with this code?? I couldn’t find any test cases not working successfully !!!
Please help !
def eidi(l):
if len(set(l[:3])) == len(set(l[3:])):
F = l[:3]
S = l[3:]
for i in range(2):
if F.index(min(F)) == S.index(min(S)):
F.pop(F.index(min(F)))
S.pop(S.index(min(S)))
continue
else:
return "NOT FAIR"
return "FAIR"
else:
return "NOT FAIR"
check = list()
for i in range(int(input())):
l = list(map(int, input().split()))
check.append(eidi(l))
print(*check, sep="\n")