作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
谁能告诉我一种方法来找到获得已知值所需的 2
的幂。例如,假设我需要找到 32 的 2 的幂。换句话说,如果我知道某个值,如何找到给出该值的 2 的幂。
if the given value is 64 how to get the power of two as 8
我之前搜索过 stackoverflow 中是否有人问过类似的问题,但遗憾的是我找不到任何问题。目前我手头上没有任何东西作为尝试,对此感到抱歉。任何帮助都非常感谢提前。
最佳答案
import math
print (math.log(64, 2))
print (2**math.log(64, 2))
输出:
6
64
关于python - 如何在 Python 中找到已知值所需的 2 次幂,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65695040/
我是一名优秀的程序员,十分优秀!