Python Fundamentals Practice - Anagrams

I’m doing exercise about function and stuck at problem 13 - Anagrams. My code worked with provided input, but there is an error when submitting answer.
Can you guys help me take a look at it? Thanks a lot

My Code:

def are_anagrams(string1, string2):
    if len(string1) != len(string2):
        return False
    arr = string1 + string2
    freq = {}
    for c in arr:
        if c in freq:
            freq[c] += 1
            freq[c] = 1
    for c in freq:
        if freq[c] == 1:
            return False
    return True

print(are_anagrams('gainly', 'laying'))
print(are_anagrams('banana', 'bacana'))

What actually happened:

Function are_anagrams did not return the expected value.

Please make sure to include the link to the Screen as well. It allows others to look at the context and try to run your code in order to better help you.

Hi, I’m stuck with problem 13 - Anagrams as well (Python Fundamentals Practice). My code worked (output matched expected output) but I got an error : Function are_anagrams did not return the expected value.

My Code:

def are_anagrams (string1, string2):

l = []
for x in string1:
    for y in string2:
        if x == y:
if len (l) == len (string1) and len (l) == len (string2):
    return True
    return False