Nov-08-2022, 07:27 PM
(This post was last modified: Nov-08-2022, 07:30 PM by carecavoador.)
You don't need to assign
As @menator01 said, it's bad practice to import everything from a module. In this case, you don't even need to import anything else than
Also, don't forget to break from the
messagebox
to a variable. Just call messagebox.showerror
straight away.As @menator01 said, it's bad practice to import everything from a module. In this case, you don't even need to import anything else than
messagebox
.Also, don't forget to break from the
while
loop or you will be stuck in it forever.from tkinter import messagebox def math(): while True: data = input("enter a,b or c ") if data == 'a': data=5 elif data == 'b': data=10 elif data == 'c': data=15 else: messagebox.showerror(title="Try",message="Wrong Input") data=0 print(data) break if __name__ == "__main__": math()