Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
python - 如何在不在python中导入任何内容的情况下获得数字的平方根?你知道我们可以这样做:
import math a = 4 s = math.sqrt(a)
但我想在不导入任何库的情况下更简单地做到这一点。
您可以在 python 行中使用 Exponentiation 执行此操作:
a = 4 b = a ** 0.5 #(1/2)