When I run this following code:
def foo():
for n in range(0, 10):
return('bar', n)
print(foo())
it prints:
('bar', 0)
When I run the exact same code but replace the 'return' with 'print'
def foo():
for n in range(0, 10):
print('bar', n)
print(foo())
it prints the following:
bar 0
bar 1
bar 2
bar 3
bar 4
bar 5
bar 6
bar 7
bar 8
bar 9
None
in the code where I use return, shouldn't it give the results same as above because I'm returning every n?