When I run the code below, I get back only the first result. If I replace return (a,d)
with print (a,d)
, I get the full set of results. (I understand that running print (a,d)
doesn't save the output anywhere.)
What do I need to change to get the full output and not just the first result?
nums = [(str(i)) for i in range(100,106)]
def foo(aa):
for a in nums:
for b in a :
c= sum(int(b)**2 for b in a)
d=''.join(sorted(a,reverse=True))
if (c>5):
return(a,d)
output = foo(nums)
print(output)
UPDATE -- I'm expecting the following output:
103 310
103 310
103 310
104 410
104 410
104 410
105 510
105 510
105 510
The return(a,d)
gives me just:
103 310