Dec-09-2021, 08:17 PM
Have a look at eval
One way could be
One way could be
operators = ['+', '-', '*', '/'] choose = input(f'Choose Operator: {operators} ') num1 = float(input('num1 >> ')) num2 = float(input('num2 >> ')) total = f'{num1}{choose}{num2}' print(eval(total))
Output:Choose Operator: ['+', '-', '*', '/'] +
num1 >> 5
num2 >> 3
5.0+3.0 = 8.0
I welcome all feedback.
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags