On Wed, Aug 16, 2017 at 6:51 AM, Dennis Lee Bieber <wlfr...@ix.netcom.com> wrote: > On 16 Aug 2017 11:06:26 GMT, r...@zedat.fu-berlin.de (Stefan Ram) declaimed > the following: > >> I wrote my first Python quiz question! >> >> It goes like this: >> >> Can you predict (without trying it out) what the Python >> console will output after the following three lines have >> been entered? >> >>def f(i): print(i); return i; >> >>f(4)**f(1)**f(2) >> > > As a first guess > > 2 > 1 > 4 > > 4 > > since in many languages, exponentiation associates right to left
I thought the same thing but figured there was no reason to eval f(2) before f(1), so I came up with 1 2 4 4 which is also wrong. -- https://mail.python.org/mailman/listinfo/python-list