用户:金钿森查看:0 回复:0 评论:0 创建时间:2020-05-14T19:08:58
【作品展示】

【作品介绍】
加减乘除加乘方,根号
【作品源代码】
Dividing = 0
Input1 = int(input('请输入第一个数字'))
Input2 = input('请选择运算类型:加,减,乘,除,开方,开根号')
if (Input2 == '加'):
Input2 = 1
if (Input2 == '减'):
Input2 = 2
if (Input2 == '乘'):
Input2 = 3
if (Input2 == '除'):
Input2 = 4
Dividing = 1
if (Input2 == '开方'):
Input2 = 5
if (Input2 == '开根号'):
Input2 = 6
Dividing = 1
Input3 = int(input('请输入第二个数字'))
if (Input3 == 0 and Dividing == 1):
print('错误')
if (Input2 == 1):
print((Input1 + Input3))
if (Input2 == 2):
print((Input1 - Input3))
if (Input2 == 3):
print((Input1 * Input3))
if (Input2 == 4):
print((Input1 / Input3))
if (Input2 == 5):
print((Input1 ** Input3))
if (Input2 == 6):
print((Input1 ** (1 / Input3)))
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn