猫史档案馆


我做的Python计算器

用户:烤香肥牛_不太香烤香肥牛_不太香查看:3 回复:1 评论:3 创建时间:2020-05-14T19:13:45


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)))


回复

上一页1 页 / 共 1下一页
wrmdcxywrmdcxy

恭喜本帖,获得【海洋】印记

点赞1


评论