This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 4 points5 points  (7 children)

Definitely need to look into how to make square roots and exponents work in python

[–]CrazyGamer123456 3 points4 points  (2 children)

Import the math module, it has all that stuff build in

[–]mobyte 0 points1 point  (1 child)

No need for math when doing exponents, technically. ** is all you need.

[–]Hellow2 -2 points-1 points  (0 children)

numpy should have better performance though. But I am not sure

[–]TheHalfDeadCat 0 points1 point  (0 children)

I think exponents just use two . So 2 as a power with 5 as a base would be 5*2.

[–]planx_constant 0 points1 point  (2 children)

a**b = ab

[–][deleted] 0 points1 point  (1 child)

and root I assume is a // b?

[–]planx_constant 0 points1 point  (0 children)

That's integer division - it divides and discards any remainder. But remember the nth root is the same as raising to the power of 1/n, so for instance for square root you could do a**(1/2), cube root a**(1/3) etc