Problem -->> EIDI GIFT

This is a solution I prepared for the problem --> Eidi Gift.

What’s wrong with this code??
I couldn’t find any test cases not working successfully !!!
Please help !
:sweat:

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")

Consider:

1
9 9 16 62 84 84 

Please link to your solution, or copy and paste it (with formatting!) here - no one wants to debug a Python screenshot :slight_smile:

This is unformatted, and won’t compile - please read the link I gave and post again with formatting :slight_smile:

Here’s my solution in python, why do you guys use so many ifs?

for _ in range(int(input())):
    info = list(map(int, input().split()))
    ages = info[:3]
    money = info[3:]
    
    final = sorted(list(zip(ages,money)))
    final.sort(reverse=True)
    flag = True
    
    gp = final[0]
    for i in range(3):
        if final[i][0] < gp[0] and final[i][1] < gp[1]: gp = final[i]
        elif final[i][0] == gp[0] and final[i][1] == gp[1]: gp = final[i]
        else: flag = False
     
    if flag: print("FAIR")
    else: print("NOT FAIR")

That’s close enough, I suppose XD

Your code fails for the following testcase:

1
12 4 6 29 24 29