>>> sum(range(49999951,50000000))
2449998775L
Is there any possible way to avoid the L at the end of number?
You are looking at a Python literal representation of the number, which just indicates that it is a python long
integer. This is normal. You do not need to worry about that L
.
If you need to print such a number, the L
will not normally be there.
What happens is that the Python interpreter prints the result of repr()
on all return values of expressions, unless they return None
, to show you what the expression did. Use print
if you want to see the string result instead:
>>> sum(range(49999951,50000000))
2449998775L
>>> print sum(range(49999951,50000000))
2449998775
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With