python error for large number mod operator -
i have data looks :
353: 340122810048577428 354: 363117512048110005 355: 387632532919029223 356: 413766180933342362 357: 441622981929358437 358: 471314064268398780 359: 502957566506000020 360: 536679070310691121 361: 572612058898037559 362: 610898403751884101 363: 651688879997206959
i trying find index divisible 1 million.
index = my_data[:,0] values = my_data[:,1] k = 0 in values: k += 1 if % 1000000 == 0 : print break print k-1
for code getting output :
5.02957566506e+17 359
but value @ index 359 502957566506000020 last 6 digits not 0 . mistake making here ?
don't use index variables i
in python. in 21st century.
s = """353: 340122810048577428 354: 363117512048110005 355: 387632532919029223 356: 413766180933342362 357: 441622981929358437 358: 471314064268398780 359: 502957566506000020 360: 536679070310691121 361: 572612058898037559 362: 610898403751884101 363: 651688879997206959""" line in s.split("\n"): k, v = line.split(":") if int(v.strip()) % 1000000 == 0: print(k)
output: nothing.
Comments
Post a Comment