Warning: mkdir(): No space left on device in /var/www/hottg/post.php on line 59

Warning: file_put_contents(aCache/aDaily/2025-07-22/post/python_codes/--): Failed to open stream: No such file or directory in /var/www/hottg/post.php on line 72
#Basics @Python Codes
TG Telegram Group & Channel
Python Codes | United States America (US)
Create: Update:

#Basics

Checking if two words are anagrams

Code:

from collections import Counter
def is_anagram(str1, str2):
return Counter(str1) == Counter(str2)

# or without having to import anything
def is_anagram(str1, str2):
return sorted(str1) == sorted(str2)

print(is_anagram('code', 'doce'))
print(is_anagram('python', 'yton'))

Output:
True
False

Share and Support
@Python_Codes

#Basics

Checking if two words are anagrams

Code:
from collections import Counter
def is_anagram(str1, str2):
return Counter(str1) == Counter(str2)

# or without having to import anything
def is_anagram(str1, str2):
return sorted(str1) == sorted(str2)

print(is_anagram('code', 'doce'))
print(is_anagram('python', 'yton'))

Output:
True
False

Share and Support
@Python_Codes


>>Click here to continue<<

Python Codes




Share with your best friend
VIEW MORE

United States America Popular Telegram Group (US)


Warning: Undefined array key 3 in /var/www/hottg/function.php on line 115

Fatal error: Uncaught mysqli_sql_exception: Too many connections in /var/www/db.php:16 Stack trace: #0 /var/www/db.php(16): mysqli_connect() #1 /var/www/hottg/function.php(212): db() #2 /var/www/hottg/function.php(115): select() #3 /var/www/hottg/post.php(351): daCache() #4 /var/www/hottg/route.php(63): include_once('...') #5 {main} thrown in /var/www/db.php on line 16