0
I’m doing an exercise here and the desired output would be Yes in this case but it’s returning me None. Could anyone help me? vlw
def alphabet (s,t,k):
    for i in range(0,len(s)):
        if s[i] != t[i] or s == 0: #o i indica o numero de chars que o s e o t tem em comum
            prefix = i
            break
        
            e = len(s) - prefix - len(t) - prefix
            if len(s) + len (t) < k:
                return 'Yes'
            elif e <= k and (e % 2) == (k % 2):
                return 'Yes'
            else:
                return 'No'
print (alphabet ('qwerasdf', 'qwerbsdf', 6))
Every function that does not have a Return explicit, automatically assumes
return None. In your case, not going into the firstifof the function, the return will be None– Paulo Marques