How to return two values from a function in Python

1 Answer

0 votes
def function(a, b):
    return a * a, b * b
 
x, y = function(2, 3)
print(x, y)
 
x, y = function(4, 5)
print(x, y)


 
'''
run:
  
4 9
16 25
  
'''

 



answered Feb 9, 2018 by avibootz
edited Apr 24, 2024 by avibootz

Related questions

2 answers 147 views
3 answers 251 views
1 answer 154 views
1 answer 130 views
4 answers 328 views
5 answers 412 views
...