猫史档案馆


【Python作品分享】计算次方【教程贴】

用户:积极的挠挠熊fQcA积极的挠挠熊fQcA查看:3 回复:5 评论:3 创建时间:2020-07-08T10:12:53


【作品展示】

center_image

 

【作品介绍】

解决计算指数很大的问题

 

【作品源代码】

power = int(input('请输入你要计算的幂:'))
index = int(input('请输入你要计算的指数:'))
power2 = power
if (index == 0 and power != 0):
    print('1')
elif (power == 0 and index != 0):
    print('0')
elif (power == 0 and index == 0):
    print('输入错误')
else:
    for __count in range((index - 1)):
        power = (power * power2)
    print(power)

 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 1下一页
蒟蒻OIer1048576蒟蒻OIer1048576

**不香?

点赞0


评论


_王子佳__王子佳_

水(凑字)

点赞0


评论


蒟蒻OIer1048576蒟蒻OIer1048576

print(int(input('底数'))**int(input('指数')))

点赞0


评论


蒟蒻OIer1048576蒟蒻OIer1048576

print(''.join([chr(p) for p ion [119, 97, 116, 101, 114]]))

点赞0


评论


Mellin_AmpMellin_Amp

不是快速幂差评

点赞0


评论