PY
py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""
Edit : I thought that we need to dispay odius numbers so i didnt show all due to limitations , but now added that too.
Found that how many numbers are odius betwen 0 - 10000
"""
def Odius(num):
ones = []
while(num):
res = num%2
ones.append(str(res))
num//=2
tms = ones.count('1')
return tms
for i in range(210):
if Odius(i)%2!=0:
print(i," is odius.")
else:
print(i," not odius.")
tm = 0
for i in range(10000):
if Odius(i)%2!=0:
tm+=1
print("\n",tm,"numbers are odius till 10000")
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run