0
Q:

python class return multiple values

return a, b
1
def fun(): 
    str = "geeksforgeeks"
    x   = 20
    return str, x
11
# A Python program to return multiple  
# values from a method using class 
class Test: 
    def __init__(self): 
        self.str = "geeksforgeeks"
        self.x = 20   
  
# This function returns an object of Test 
def fun(): 
    return Test() 
      
# Driver code to test above method 
t = fun()  
print(t.str) 
print(t.x) 
1

New to Communities?

Join the community