So I'm creating a program that gives random outputs including addition, subtraction, multiplication and division. In order to remove repeating any code I am attempting to narrow the function down to essentially
sum(operand)
a = random.randint(1, 10)
b = random.randint(1, 10)
c = a + operand + b
print c
I am looking to be able to call say sum(*) so c would return the product of a and b. I feel like this is a concatenation issue Here I am using sum as an arbitrary name. The function should be able to add, subtract, multiply and divide, all depending on the operand passed through. For example, if "-" is passed through, c would be a - b, if "/" was passed through, c would be a / b
Thanks