+ 4

Python problem (solved)

Why is it showing bigger number? If 2**2**2 shows 16. Then why 2**2**2**2 is 65536 (exected answer is 256)? https://code.sololearn.com/ce3ee0pV05o7/?ref=app

3rd Jan 2021, 10:26 AM
<k>Kartik</k>
14 odpowiedzi
+ 10
It's similar to this question. Hope it helps you https://www.sololearn.com/Discuss/2651824/?ref=app
3rd Jan 2021, 10:45 AM
Simba
Simba - avatar
+ 7
Try this for example The code will execute right to left rather than left to right cause that's how multiple exponent really works. . https://code.sololearn.com/cFoecTgkLV91/?ref=app
3rd Jan 2021, 10:45 AM
noteve
noteve - avatar
+ 4
<k>~~~~~~~~~~~~</k> Understand again 2**2 Means 2 is the power of 2 So here 2**2**(2**2) 2**(2**4) 2**16 #your bigger number
3rd Jan 2021, 10:40 AM
A͢J
A͢J - avatar
+ 2
you are doing an exponentiation why you gave a large number, try to do 2 * 2 * 2 * 2 that will give the result you want
3rd Jan 2021, 10:33 AM
Andrea Barreto
Andrea Barreto - avatar
+ 2
<k>~~~~~~~~~~~~</k> Check what will be 2**16
3rd Jan 2021, 10:42 AM
A͢J
A͢J - avatar
+ 2
Check (2**2)#4 Or (2**2**2)#16 Then(2**16)#65536 Which means (2**2**2**2)#65536
4th Jan 2021, 7:45 PM
esther ozuem
esther ozuem - avatar
+ 1
Simba Thank you so much. I got it😊
3rd Jan 2021, 11:02 AM
<k>Kartik</k>
+ 1
《 Nicko12 》 Thank you so much. I got it😊
3rd Jan 2021, 11:03 AM
<k>Kartik</k>
+ 1
Wedad Saleh Nice way to explain.Thank you so much😊
3rd Jan 2021, 11:07 AM
<k>Kartik</k>
0
I Am AJ ! It is showing 65536
3rd Jan 2021, 10:41 AM
<k>Kartik</k>
0
print(2**2)#4 print(2**2**2)#16 print(2**16)#65536 print(2**2**2**2)#65536
3rd Jan 2021, 10:59 AM
**🇦🇪|🇦🇪**
**🇦🇪|🇦🇪** - avatar
0
I Am AJ ! Ohh!! Now I understood. Thank you so much😊
3rd Jan 2021, 11:05 AM
<k>Kartik</k>
0
Andrea Barreto Yes, Now I understood. Thank you so much😊
3rd Jan 2021, 11:06 AM
<k>Kartik</k>
0
Using (*) two times after a number makes the number after '( ** )' raised to the first number as we write square and cubes in maths, 2^2 = 4, we get the second number squared as a output. This code will help you to undewrstand it in a better way. https://code.sololearn.com/cnUNp5Ahh4jg/?ref=app
5th Jan 2021, 2:23 AM
Yash Thale
Yash Thale - avatar