我的程序要求用户输入一个电源和他们想要的数字。并查找最后一个将2的多个数字提升到用户输入的幂次方的数字。你知道吗
我的代码是这样的。我只是python的初学者。我没有得到想要的结果。你知道吗
temp = int(input('Enter the power of the number: '))
temp2 = int(input('Enter the no.of digits you want: '))
temp3 = (2 ** temp) // temp2
temp4 = (temp3 % 100)
print('The last that many digits of the number raised to the power is is:',temp4)
我假设你在找这样的东西:
功率:8
数字:2
2^8=256个
最后两位=56
为此,您的代码如下所示:
另一种方法是:
相关问题 更多 >
编程相关推荐