+ 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
3 odpowiedzi
+ 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.
+ 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.
+ 1
c=a*b**c**3//2 sorry i wrote it wrong