dde272c4b8
i18n - Build Validation / Validate i18n Builds (24) (push) Has been cancelled
CI - Node.js / Lint (24) (push) Has been cancelled
CI - Node.js / Build (24) (push) Has been cancelled
CI - Node.js / Test (24) (push) Has been cancelled
CI - Node.js / Test - Upcoming Changes (24) (push) Has been cancelled
CI - Node.js / Test - i18n (italian, 24) (push) Has been cancelled
CI - Node.js / Test - i18n (portuguese, 24) (push) Has been cancelled
CD - Docker - GHCR Images / Build and Push Images (push) Has been cancelled
1.7 KiB
1.7 KiB
id, title, challengeType, dashedName
| id | title | challengeType | dashedName |
|---|---|---|---|
| 681cb1afdab50c87ddb2e517 | Challenge 6: Anagram Checker | 29 | challenge-6 |
--description--
Given two strings, determine if they are anagrams of each other (contain the same characters in any order).
- Ignore casing and white space.
--hints--
are_anagrams("listen", "silent") should return true.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(are_anagrams("listen", "silent"), True)`)
}})
are_anagrams("School master", "The classroom") should return true.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(are_anagrams("School master", "The classroom"), True)`)
}})
are_anagrams("A gentleman", "Elegant man") should return true.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(are_anagrams("A gentleman", "Elegant man"), True)`)
}})
are_anagrams("Hello", "World") should return false.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(are_anagrams("Hello", "World"), False)`)
}})
are_anagrams("apple", "banana") should return false.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(are_anagrams("apple", "banana"), False)`)
}})
are_anagrams("cat", "dog") should return false.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(are_anagrams("cat", "dog"), False)`)
}})
--seed--
--seed-contents--
def are_anagrams(str1, str2):
return str1
--solutions--
def are_anagrams(str1, str2):
def clean(s):
return sorted(s.replace(" ", "").lower())
return clean(str1) == clean(str2)