3 回答
TA贡献1842条经验 获得超21个赞
以下代码片段:
def function_one():
variable_one = 1
variable_two = 2
return variable_one, variable_two
def function_two():
variable_one, variable_two = function_one()
use_function_one_variable = 'gibberish' + str(variable_one)
print(use_function_one_variable)
print(variable_two)
function_two()
产生你想要的输出:
gibberish1
2
TA贡献1829条经验 获得超9个赞
从function_two(),您必须致电function_one():
def function_two():
v1, v2 = function_one()
use_function_one_variable = 'gibberish' + str(v1)
print(use_function_one_variable)
print(v2)
TA贡献2080条经验 获得超4个赞
def function_one():
variable_one = 1
variable_two = 2
return variable_one, variable_two
def function_two():
print_this_one, print_this_two = function_one()
print_this_one += 'gibberish'
print_this_two += 'more gibberish'
print(print_this_one)
print(print_this_two)
添加回答
举报