Reputation: 11
How do I get both values while compiling? It is only returning 129.
def nestedListSum(NL):
if isinstance(NL, int):
return NL
o=NL*2
return o
# some examples
print(nestedListSum(129))
Upvotes: 0
Views: 33
Reputation: 122373
Put all values that you want to return in a single return
statement:
def nestedListSum(NL):
if isinstance(NL, int):
o = NL * 2
return NL, o
print(nestedListSum(129))
This returns a tuple (129, 258)
.
Upvotes: 2