0
Wap to input 2 tuples A and B and print true if every element of tuple B else it returns false
A=eval(input("enter a tuple")) B=eval(input("enter a tuple")) c=0 for i in range (0,len(A)): for j in range(0,len(B)): if A[i]==B[i]: c+=1 if c==0: print("false") break else: print("true")
1 Answer
0
You only need a single loop and no break:
for i in range(0,len(B)):
if A[i]==B[i]:
c+=1
And if every element of the tuple (all TWO) have to be identical, you have to test for that.
if c<2:
print("false")
else:
print("true")