# 只能调用一个函数的返回值，而不可以调用其中的其他指令吗？

``````def math(num_1, num_2):
global operation
if operation == '+':
x = num_1 + num_2
elif operation == '-':
x = num_1 - num_2
elif operation == '*':
x = num_1 * num_2
elif operation == '/':
x = num_1 / num_2
return float(x)

def opp():
print("To multiply, press '*'")
print("To divide, press '/'")

def inp():
num_1 = input("Enter first number: ")
num_2 = input("Enter second number: ")
return float(num_1), float(num_2)

a, b = inp()

opp()
operation = input()

result = math(a, b)

print("The result is: " + str(result))
``````

``````def opp():
print("To multiply, press '*'")
print("To divide, press '/'")
operation = input()
return operation

def inp():
num_1 = input("Enter first number: ")
opp()
num_2 = input("Enter second number: ")
return float(num_1), float(num_2)
``````

And then I want to input the output of `opp()` into `math()`, but when I try to replace the `operation` variable in `math()` with `opp()`, then the entire `opp()` function executes, including its print statements.

Is there a way to input the return of `opp()` into `math()`?

Don't use `global` - that's a bad way to move data around inside a program. Instead, just return `operation` from `inp()`, and pass it as a parameter to `math()`.

``````def math(operation, num_1, num_2):
if operation == '+':
x = num_1 + num_2
elif operation == '-':
x = num_1 - num_2
elif operation == '*':
x = num_1 * num_2
elif operation == '/':
x = num_1 / num_2
return float(x)

def opp():
print("To multiply, press '*'")
print("To divide, press '/'")
operation = input()
return operation

def inp():
num_1 = input("Enter first number: ")
operation = opp()
num_2 = input("Enter second number: ")
return operation, float(num_1), float(num_2)

operation, a, b = inp()

result = math(operation, a, b)

print("The result is: " + str(result))
``````

``````Enter first number: 2