Question: 
Write a python function to find number of integers with odd number of set bits.


Model's Code:
def count_With_Odd_SetBits(n):
    def is_odd_set_bits(x):
        return bin(x).count('1') % 2 == 1
    
    count = 0
    for i in range(1, n + 1):
        if is_odd_set_bits(i):
            count += 1
    return count



Sample Correct Code:
def count_With_Odd_SetBits(n): 
    if (n % 2 != 0): 
        return (n + 1) / 2
    count = bin(n).count('1') 
    ans = n / 2
    if (count % 2 != 0): 
        ans += 1
    return ans 


Asserts:
assert count_With_Odd_SetBits(5) == 3
assert count_With_Odd_SetBits(10) == 5
assert count_With_Odd_SetBits(15) == 8


Tests:
Test 1 of 3: PASS
Test 2 of 3: PASS
Test 3 of 3: PASS

Test 78 of 974: 59/78 (75.64102564102564%): success