Q. Given a tuple pair ((2,5),(4,2),(9,8),(12,8)),count the number of pair (a,b) such that a and b are even .
You can understand by Watching video :-

Answer :-
tup = ((2,5),(4,2),(9,8),(12,8)) count = 0 for i in range (len(tup)): if tup [i][0] % 2 == 0 and tup[i][1] % 2 == 0: count += 1 print("The number of pair (a,b) such that a and b are even = ",count)
Output :-
The number of pair (a,b) such that a and b are even = 2
>>>
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )