chevron_left chevron_right

• 0 Vote(s) - 0 Average

 Need help with simple python math filter_list Linear Mode Threaded Mode View a Printable Version Author Message
Need help with simple python math #1
How am I getting two different results? I'm wanting to know what 2^3^4 is for practice. But I'm getting two different answers.

http://imgur.com/a/1qpLQ

RE: Need help with simple python math #2
2^3^4 = 2^81 = 2.417852×10^24
(2^3)^4 = 2^3*4 = 2^12 = 4096

The two things are widely different, that's why you get different answers

Got me @FurryRock
My website
I am SimPlaysGames

1 user Likes Sikom's post
RE: Need help with simple python math #3
(02-01-2017, 12:39 PM)SimPlaysGames Wrote: 2^3^4 = 2^81 = 2.417852×10^24
(2^3)^4 = 2^3*4 = 2^12 = 4096

The two things are widely different, that's why you get different answers

Got me @FurryRock

Man I need to go back to 9th grade, it looks like with knowledge of PEMDAS that the first equation would be:
2^3^4
8^4
4096

But apparently you need to solve 3^4 first, yeah I need to go back to school. Thanks tho.

RE: Need help with simple python math #4
Damn simplaygames is coming up in he world!!! good job bud
˙˙˙ɹǝɥʇouɐ uᴉ sǝʌᴉl ƃuᴉʌɐs 'pɐǝɹɥʇ ǝuo uᴉ ƃuᴉlloɹ┴

RE: Need help with simple python math #5
It seems your problem is already resolved, but I would recommend using the builtin pow() method. It's implemented in C (in Python 3, anyway), so it executes faster than the double star (**) operator in any case I can recall, and it tends to be far less confusing in big equations if you're familiar with Python's syntax.

Code:
```>>> (2**3)**4 4096 >>> pow(pow(2,3),4) 4096```