How can I return multiple variables from a function in python? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can I return multiple variables from a function in python?

def something(): a = 2*3 b = 4**4 c = 9-12 return a I want to use the value of the b and c too in other functions. How to do that? This is quite possible in Golang by the way.

3rd May 2022, 1:34 PM
Subhadeep Mandal
Subhadeep Mandal - avatar
1 Answer
+ 2
return a,b,c Possible in python also.. a, b, c = something() print(something ()) #returned values as a tuple
4th May 2022, 10:59 AM
Jayakrishna 🇮🇳