[docs] DE-buging I LOVE LOU!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Berker Peksağ berker.peksag at gmail.com
Tue Jan 9 09:59:19 EST 2018


On Tue, Jan 9, 2018 at 3:24 PM, 이재하 <jaeha0919 at naver.com> wrote:

> Hello,my name  is Jaeha Lee,and I'm live in Korea.
>
> I'm student(14) and like programming VERY VERY MUCH!!!!
>
> Of course, I'm writing this e-mail for tell you about the bug in python.
>
> it is very small and small. but please fixed it(im so hard to make my
> school task TT)
>
> ammm..... first "5**5**5"  [ 5^5^5 ](it's not string.)This expression has
> the original value of 298023223876953125(3125*5), but appears as(it is
> little big ^^;;;;;LOL)
>
> 191101259794547752035640455970396459919843762136325730321645
> 282979486862576245362218017673224940567642819360078720713837
> 072355305446356153946401185348493792719514594505508232749221
> 605848912910945189959948686199543147666938013037176163592594
> 479746164225082316490967285712171708123232790481817268327510
> 1127467823174109858886837085.....................................
> 439421823219135722305406671537337424854364566378204570165459
> 321815405354839361425066449858540330746646854189014813434771
> 4650315037954175778622811776585876941680908203125
>
> his means not 3125*5 but 5*3125
>
> it means a^a^a=>a^(a^a)
>
> 
> not (a^a)^a
>
> so, please debuging it. thank you...
>
Hi Jaeha,

Thank you for your email. I know this is a bit confusing but the result of
5**5**5 is correct. Python usually evaluate operators within the same
category (for example + and - operators) from left to right. So 5 - 2 + 3
will return 6 (it would return 0 if Python evaluated them from right to
left) However, the ** operator is an exception to the "evaluate from left
to right" rule and Python will evaluate them from right to left. So 5**5**5
will be calculated as 5**3125 not 3125**5 as you already described in your
email.

I hope that helps and thank you for using Python! :)

--Berker
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/docs/attachments/20180109/5072d176/attachment-0001.html>


More information about the docs mailing list