def is_anagram(t,u):
    if sorted(t)== sorted (u):
        return True
        return False

print is_anagram('realtor', 'rotlear') # True
print is_anagram('superpuff','local') # False
print is_anagram('alla', 'lala') # True
print is_anagram('tools', 'stool') # True
print is_anagram('double', 'trouble') # False
Votes + Comments
Think Python - Exercise 10.7 - THINK BEFORE YOU POST!
4 Years
Discussion Span
Last Post by pyTony

So are you happy with this code,do you have a question?
Just to post some code without any question is not helping anyone,it's just irritating.


I am new to Python and couldn't find any other posts concerning this Exercise. Does anyone have any other suggestions besides the built-in sorted() function? I printed the Python Quick Reference by Chris Hoffman but it is dated 1995 and wasn't sure if there was a newer QR than that. I am still learning a lot of the basic coding and the last programming class I took was Turbo Pascal in 1995. This is part of my online only Object-Oriented Programming class at Trident International University. I'm finding it difficult to do some of this homework and going through the books and websites like this one is helping a lot. Sorry for not saying that before. Thank you, snippsat.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.