0
Little help with this problem.. What's wrong in this code?
A group has N members each numbered from 1 to N. A member of the group admires other member if it's number divides other member's number. Given N, find how many members have odd number of admirers. Input: T the number of test cases. For each test case an integer N. Output: A single integer representing the number of members with odd admirers. Constraints: 1 <= T <= 100 1 <= N <= 100 My code: t = int(input()) odds = [] i=1 if 1 <= t <= 100: while i <= t: num = int(input()) if 1 <= num <= 100: alist = list(range(1,num + 1)) for n in alist: o = list(n%x ==0 for x in alist if x != n) if o.count(True) % 2 != 0: odds.append(n) print(len(odds)) odds = [] i += i
1 ответ
0
Hacker Rank?