diff --git a/Make_a_function_that_does_arithmetic_kyu8.py b/Make_a_function_that_does_arithmetic_kyu8.py new file mode 100644 index 0000000..9feb09a --- /dev/null +++ b/Make_a_function_that_does_arithmetic_kyu8.py @@ -0,0 +1,14 @@ +# # A function that foes arithmetic with two numbers and an operator in string form. +# Works out the correct operator by using ifs then returns + +def arithmetic(a, b, operator): + if operator == "add": + return a + b + elif operator == "subtract": + return a - b + elif operator == "multiply": + return a * b + elif operator == "divide": + return a / b + else: + return "Error" \ No newline at end of file