Actually, I am a newbie in python. I have doubt in return in for loop section. -> if i return inside loop output is 1 for (for string "abcd"). -> if I return with the same indentation that for is using in code, the output will 4. Can you please explain this happening?
I have added my problem briefly using the comment in code also.
def print_each_letter(word):
counter = 0
for letter in word:
counter += 1
return counter #its returning length 1 why ?
return counter # its returning length 4 why?
print_each_letter("abcd")