I have written a function that takes two strings as arguments and returns true or false on whether they have the exact same letters in them. This is my code for it:
def anagram(str1,str2):
str1 = sorted(str1)
str2 = sorted(str2)
if str1 == str2:
print("True")
else:
print("False")
I now need to define a procedure called test_anagram() that calls the anagram function with different string arguments, using at least three true and false cases. For each case the string and result should be printed out.
I'm not sure about how to achieve this, could anyone help me out?
Just define it like any other function and call the
anagram
function insidetest_anagram
pass strings as arguments: