没有合适的资源?快使用搜索试试~ 我知道了~
用户输入一个类似这样 3*( 4+ 50 )-(( 100 + 40 )*5/2- 3*2* 2/4+9)*((( 3 + 4)-4)-4) 这样的表达式,假设表达式里面除了包含空格、'+'、'-'、'*'、'/'和括号再无其他特殊符号,然后自己动手写代码解析其中的表达式,实现加减乘除,最后得出的结果与真实的计算机所算的结果必须一致。
资源推荐
资源详情
资源评论
import re
import tkinter
import tkinter.messagebox
#Farme Work
root = tkinter.Tk()
# the size of the screen
root.geometry('350x270+400+100')
# title of the programm
root.title('calculator')
# Text box to display information, nonreadable
contentVar = tkinter.StringVar(root,'')
contentEntry = tkinter.Entry(root,textvariable=contentVar)
contentEntry['state'] = 'readonly'
contentEntry.place(x=10, y=10, width=280, height=20)
#Button code
def buttonClick(btn)
content = contentVar.get()
#If the number starts as a decimal, add 0 to the decimal point
if content.startswith('.'):
content = '0' + content
#Sets a variable to save a list of operands and symbols
lists = []
#To determine whether to press the operation symbol
isPressSign = False
isPressNum = False
#数字函数
def pressNum(num): #设置一个数字函数 判断是否按下数字 并获取数字将数字写在显示版上
import tkinter
import tkinter.messagebox
#Farme Work
root = tkinter.Tk()
# the size of the screen
root.geometry('350x270+400+100')
# title of the programm
root.title('calculator')
# Text box to display information, nonreadable
contentVar = tkinter.StringVar(root,'')
contentEntry = tkinter.Entry(root,textvariable=contentVar)
contentEntry['state'] = 'readonly'
contentEntry.place(x=10, y=10, width=280, height=20)
#Button code
def buttonClick(btn)
content = contentVar.get()
#If the number starts as a decimal, add 0 to the decimal point
if content.startswith('.'):
content = '0' + content
#Sets a variable to save a list of operands and symbols
lists = []
#To determine whether to press the operation symbol
isPressSign = False
isPressNum = False
#数字函数
def pressNum(num): #设置一个数字函数 判断是否按下数字 并获取数字将数字写在显示版上
资源评论
qq_39445096
- 粉丝: 1
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功