Paul Rubin <[email protected]> writes:
> Python 3.7.3 (default, Apr 3 2019, 05:39:12)
> Type "help", "copyright", "credits" or "license" for more information.
> >>> a = range(10)
> >>> b = reversed(a)
> >>> sum(a) == sum(b)
> True
> >>> sum(b) == sum(a)
> False
Why does this happen?
By the way, when you change the last statement to:
sum(a) == sum(b)
you also get False.
--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
--
https://mail.python.org/mailman/listinfo/python-list