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

24th Feb 2020, 12:25 PM
Rajat Srivastava
Rajat Srivastava - avatar
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")
24th Feb 2020, 12:49 PM
HonFu
HonFu - avatar