calling a function from another function in python
<p>I have written this function that takes to strings in order to see if they are anagrams:</p>

<pre><code>def anagram_check(str_x, str_y):
    x = string1.replace(" ","")
    y = string2.replace(" ","")
    lower1 = x.lower()
    lower2 = y.lower()
    sorted1 = sorted(lower1)
    sorted2 = sorted(lower2)
    if sorted1 == sorted2:
        return True
    else:
        return False
</code></pre>

<p>this function works fine, the problem is that now I need to use this function in another function in order to find anagrams in a text file. I want to print a list of tuples with all the anagrams in it. this is what i have done so far</p>

<pre><code>def anagrams_finder(words_num):
    anagrams = []
    f = open("words.txt")
    a = list(f)
    list1 = ([s.replace('\n', '') for s in a])
    list2 = ([i.lower() for i in list1])    
    list3 = list2[0:words_num] #number of words from text that need to be checked.   
    for i in list3:
</code></pre>

<p>....</p>

<p>I tried using for loops, while loops, appand.... but nothing seems to work. how can I use the first function in order to help me with the second?
Please help...</p>
