Nov-07-2019, 06:57 PM
There is no switch/case statement in Python. Use if/elif instead or a data structure. You did use a data structure, but I would do it this way:
operators = {'1': add, '2': subtract, '3': divide, '4': multiply, '5': increase} ... if choice in operators: print(operators[choice](a, b))
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures