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 250 views
1 answer 153 views
1 answer 129 views
4 answers 327 views
5 answers 411 views
...