小编Pra*_*Are的帖子

python中的基本计算器程序

我刚刚在python中编写了一个简单的计算器脚本,通常python应该默认识别( - )减号,(*)乘法,(/)除号,但在考虑这个脚本时,它无法识别符号.请留下您的意见以清除我......

#! /usr/bin/python

print("1: ADDITION")
print("2: SUBTRACTION")
print("3: MULTIPLICATION")
print("4: DIVISION")

CHOICE = raw_input("Enter the Numbers:")

if CHOICE == "1":
    a = raw_input("Enter the value of a:")
    b = raw_input("Enter the value of b:")
    c = a + b
    print c

elif CHOICE == "2":
    a = raw_input("Enter the value of a:")
    b = raw_input("Enter the value of b:")
    c = a - b
    print c

elif CHOICE == "3":
    a = raw_input("Enter the value of a:")
    b …
Run Code Online (Sandbox Code Playgroud)

python calculator

0
推荐指数
1
解决办法
3万
查看次数

标签 统计

calculator ×1

python ×1