Mar-09-2020, 07:03 AM
I have this program.
This question involves lines 25-51.
To solve the equations it has a long if\elif\else. I want to know if I can eliminate that by putting the operators in a list
something like:
This question involves lines 25-51.
To solve the equations it has a long if\elif\else. I want to know if I can eliminate that by putting the operators in a list
["+", "-", "*", "/"] and use a for-loop to match them to a list like [add, sub, div, mult]?something like:
text_in = StringVar()
add, sub, div, mult = solve
symbol_list = ["+", "-", "*", "/"]
operator_list = [add, sub, div, mult]
for i in range(len(symbol_list)):
# select i from operator_list
text_in.set(i)I am probably showing my ignorance but...
