Write a program to print the number of odd elements in the array.
Input Format
The first line contains n - the number of test cases.
Each test case contains m, followed by m integers. m is the number of elements in the array, and the integers that follow are the elements of the array.
Example Input:
3
3 82 96 85
4 11 91 49 47
5 40 38 35 1 56
Output:
1
4
2
Answers
Answered by
0
test_cases = int(input(" Enter test cases : "))
numbers_grp = []
num_of_elements = []
for i in range(test_cases):
numbers_grp.append(list(input().split(" ")))
for group in numbers_grp:
nums = 0
for number in group:
if int(number)%2 != 0:
nums += 1
num_of_elements.append(nums)
for i in num_of_elements:
print(i)
If any error occurs, You can dm me on insta:
@rdx_dilawar
Similar questions
Hindi,
4 months ago
Math,
4 months ago
Math,
9 months ago
Business Studies,
9 months ago
Math,
1 year ago
Math,
1 year ago
CBSE BOARD X,
1 year ago