TOPIC

10% wrong in python help pls

nameless55 asked 7 months ago

T = int(input())
for k in range(T):
    unnessesary_variable = int(input())
    a = input().split()
    b = input().split()
    result = []
    for i in range(len(a)):
        M_count = 0
        A_count = 0
        P_count = 0

        C = list(b[i])
        for j in C:
            if j=="P":
                P_count+=1
            elif j=="A":
                A_count+=1
            elif j=="M":
                P_count+=1

        total_class = A_count+P_count+M_count
        if total_class!=0:
            if P_count/total_class<0.75:
                result.append(a[i])
        else:
            pass

    print(" ".join(result))

This topic has not been answered yet. Be the first!

Remember not post solutions. Your post may be reviewed by our moderators.