List of numbers have same data but different sum
Question:
I have two lists of numbers. After comparing them with zip(), they are same (at least what I know) but there sum is different.
You can get the script with list of numbers here as the script is huge, I cannot fix it in this question: https://mega.nz/file/dHgHEQQA#9k9s86hgGH_vWrcE8J6ixYdu3GYkfwtw0V0IBvuhd4o
As you can see, line 1392 is not printing so, the list should be same.
Am I comparing wrong or what is the problem?
Answers:
Check the length of the list. e
appears to be having 694
elements and r
appears to be having 693
elements. so, zip
aggregates only 693 elements. Hence the sum
are different.
print(len(e), len(r), len([x for x in zip(e, r)]))
# 694 693 693
I have two lists of numbers. After comparing them with zip(), they are same (at least what I know) but there sum is different.
You can get the script with list of numbers here as the script is huge, I cannot fix it in this question: https://mega.nz/file/dHgHEQQA#9k9s86hgGH_vWrcE8J6ixYdu3GYkfwtw0V0IBvuhd4o
As you can see, line 1392 is not printing so, the list should be same.
Am I comparing wrong or what is the problem?
Check the length of the list. e
appears to be having 694
elements and r
appears to be having 693
elements. so, zip
aggregates only 693 elements. Hence the sum
are different.
print(len(e), len(r), len([x for x in zip(e, r)]))
# 694 693 693