I have following code below.
class NameParser:
def __init__(self):
self.getName
def getName(self, name):
splitName = name.split(' ')
surname = splitName.pop()
for i in range(len(splitName)):
print('Name: %s' % splitName[i])
return('Surname: %s' % surname)
np = NameParser()
print(np.getName("ali opcode goren"))
# output: name: ali, name: opcode, surname: goren
How do i return two values? Like following code:
for i in range(len(splitName)):
return('Name: %s' % splitName[i])
return('Surname: %s' % surname)
# output: name ali: (error) i want all values name, name, surname
I want all values but just one output. How can I solve this problem?