+ 2

Python

a=3 b=2 c=a*b**2**3 print(c) It will print 512 but can someone explain the mathematical logic behind this I get that ** is used for expressing an exponent. In other words how do we arrive to 512 I’ve tried several times but I’m not arriving to 512

12th Feb 2019, 6:38 PM
Safina Nganga
Safina Nganga - avatar
3 ответов
+ 2
>It will print 512 Well, it doesn't result in 512 because 3*2**2**3 equals 768. Maybe there is something in the previous code that distort the result or changes one of the variables. I guess you just mistyped something. Hope I could help.
12th Feb 2019, 7:09 PM
Max_Mnemo
Max_Mnemo - avatar
+ 2
So c is within c itself? If I type in what you said: a=3 b=2 c=a*b**c**3//2 print(c) -> ERROR Makes sense because C is just not defined. Also are you sure there is an exponenent within an exponent? 3//2=1 so, c**3//2 is just c**1 which is simply c. c=a*b**c Now you just have to put the one c on the right to the left side.
13th Feb 2019, 8:55 AM
Max_Mnemo
Max_Mnemo - avatar
+ 1
c=a*b**c**3//2 sorry i wrote it wrong
12th Feb 2019, 7:35 PM
Safina Nganga
Safina Nganga - avatar