Not sure what do you mean by comma at hundredth place.
So, I'm answering for both possibilities.
num = 1487526645
num_str = str(num)
result = ''
counter = 0
for i in range(len(num_str) - 1, -1, -1):
if len(num_str) <= 3:
result = 'NO'
break
counter += 1
result = num_str[i] + result
if counter % 3 == 0:
result = ',' + result
print(result)
will give you the output 1,487,526,645
.
and
num = 1487526645
num_str = str(num)
result = ''
counter = 0
for i in range(len(num_str) - 1, -1, -1):
if len(num_str) <= 3:
result = 'NO'
break
counter += 1
result = num_str[i] + result
if (counter % 3 == 0 and counter <= 3) or ((counter - 3) % 2 == 0 and counter > 3):
result = ',' + result
print(result)
will give you the output 1,48,75,26,645
.
P.S.- As others will mention, it's a good practice to show your work before asking others for a solution. It shows your effort which everyone appreciates and encourages to help you.