I'm trying to represent number in Indian/US notation but the value I give and the output are not the same. Please check the code.
import locale
result = 1
for i in range(1,65):
result = result*i
print (result)
output: 126886932185884164103433389335161480802865516174545192198801894375214704230400000000000000
print(f'{result:,}')
output: 126,886,932,185,884,164,103,433,389,335,161,480,802,865,516,174,545,192,198,801,894,375,214,704,230,400,000,000,000,000
locale.setlocale(locale.LC_MONETARY, 'en_IN')
print(locale.currency(result, grouping=True))
output:₹1,26,88,69,32,18,58,84,16,54,37,80,68,97,58,51,22,92,52,90,11,90,29,06,47,05,20,97,78,50,85,45,10,34,77,59,05,11,63,70,67,40,17,89,440.00
locale.setlocale(locale.LC_MONETARY, 'en_US')
print(locale.currency(result, grouping=True))
output:$126,886,932,185,884,165,437,806,897,585,122,925,290,119,029,064,705,209,778,508,545,103,477,590,511,637,067,401,789,440.00
if you notice with print(f'{result:,}')
the value of result does not change, but the problem is with locale package where the result and output changes from 12688693218588416
.
Questions:
1.Why does the value change?
2.How to correct this?