In order to do this for 2 strings you can do this:
def isAnagram(str1, str2):
str1_list = list(str1)
str1_list.sort()
str2_list = list(str2)
str2_list.sort()
return (str1_list == str2_list)
As for the iteration on the list, it is pretty straight forward
More Related Contents:
- How can I check if two strings are anagrams of each other?
- Enhancement of unix script [closed]
- Python if statements [closed]
- How do i implement these algorithms below
- How to efficiently compare two unordered lists (not sets) in Python?
- How to animate a scatter plot
- In Django, how does one filter a QuerySet with dynamic field lookups?
- How does Python manage int and long?
- How to avoid explicit ‘self’ in Python?
- Convert a timedelta to days, hours and minutes
- Remove duplicate rows from Pandas dataframe where only some columns have the same value
- How do I check for an EXACT word in a string in python
- Why is matrix multiplication faster with numpy than with ctypes in Python?
- Unable to install Python libraries
- socket.error: [Errno 48] Address already in use
- How do you convert a datetime/timestamp from one timezone to another timezone?
- How to access the elements of a 2D array?
- Bulk insert huge data into SQLite using Python
- Sending mail error with python smtplib
- Cannot change global variables in a function through an exec() statement?
- Fastest-in term of space- way to find prime numbers with python
- How do I find the maximum (larger, greater) of 2 numbers?
- Can Pandas read and modify a single Excel file worksheet (tab) without modifying the rest of the file?
- Converting Flask form data to JSON only gets first value
- ImportError: libSM.so.6: cannot open shared object file: No such file or directory
- What is the default order of a list returned from a Django filter call?
- ImportError: cannot import name SignedJwtAssertionCredentials
- Is it possible to do partial inheritance with Python?
- Model help using Scikit-learn when using GridSearch
- Change the file extension for files in a folder?