Why it outputs 3..? Can anyone plz explain this.. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

Why it outputs 3..? Can anyone plz explain this..

Print(3**1**2**4) Output: 3 But why?

10th Aug 2019, 10:22 AM
Sujithra
2 Answers
+ 18
😎 "Awesome" Lover ❤️ It's evaluated last to first so first 2**4 is evaluated then 1**16 then 3**1 so output is 3 (3**((1)**(2**4))) 2**4 =16 1**16 = 1 3 ** 1 = 3 so output is 3
10th Aug 2019, 10:30 AM
GAWEN STEASY
GAWEN STEASY - avatar
+ 6
GAWEN STEASY and Jay Matthews ... Thnq so much for explaining ☺️
10th Aug 2019, 10:32 AM
Sujithra