Its Not working as expected why …?
# cook your dish here
t = int(input())
for i in range(t):
A,B,A1,B1,A2,B2 = input().split()
A = int()
B = int()
A1 = int()
B1 = int()
A2 = int()
B2 = int()
if A == A1 or B1:
if B == A1 or B1:
elif A == A2 or B2:
if B == A2 or B2:
Problem Link: PROGLANG Problem - CodeChef
There seems to be a few problems with your code.
- Not taking inputs correctly: map function would have been useful to take multiple inputs present in a single line, or, they could have been taken as a list like;
- Not checking condition correctly: Your if condition will not check if A equals to B1. It will only check if A equals to A1 and will take B1 as either True, if B is non-zero, or as False, if B is zero.
The condition should have been like this;
if( (A==A1) or (A==B1) ):
You can have a look at my code for better understanding.
for _ in range(int(input())):
if( ((a==a1)or(a==b1))and((b==b1)or(b==a1)) ):
elif( ((a==a2)or(a==b2))and((b==b2)or(b==a2)) ):
Thanks for the help, it works well now i also now understand where i went wrong …