what is the simplest way to pass two variables to a function in Python and get two variables back from the function
thanks in advance.
what is the simplest way to pass two variables to a function in Python and get two variables back from the function
thanks in advance.
You write a function that takes 2 inputs, and return a comma separated list of outputs:
def function(first, second):
return first, second
firstOutput, secondOutput = function(1,2)
You could make a definition that takes 2 values as an input, and have a return below that that returns 2 values.
For example:
#Create a definition
def HelloWorld(valueA, valueB):
print(valueA)
print(valueB)
return 'Hello', 'World'
# Call the definition
HelloWorld('HelloA', 'HelloB')