林心憲GUI計算機eval函數比較美國與印度程式碼
印度計算機 程式碼: from tkinter import * def button_press ( num ): global equation_text equation_text = equation_text + str (num) equation_label.set(equation_text) def equals (): global equation_text try : total = str ( eval (equation_text)) equation_label.set(total) equation_text = total except SyntaxError : equation_label.set( "syntax error" ) equation_text = "" except ZeroDivisionError : equation_label.set( "arithmetic error" ) equation_text = "" def clear (): global equation_text equation_label.set( "" ) equation_text = '' window = Tk() window.title( '林心憲拷貝美國人的程式碼' ) window.geometry( "500x500" ) equation_text = "" equation_label = Stri...