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
Q 8 type C || tuples || Sumita arora || class 11|| computer science || Q 8 type c chapter tuples sumita arora class 11|| 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 . Website Link :- https://www.pathwalla.com/2019/06/class-11-computer-science-sumita-arora_52.html 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
Q 8 type C || tuples || Sumita arora || class 11|| computer science || Q 8 type c chapter tuples sumita arora class 11|| 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 . Website Link :- https://www.pathwalla.com/2019/06/class-11-computer-science-sumita-arora_52.html 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