Isogram with “word” | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Isogram with “word”

JavaScript Create a funtion called isIsogram that takes one argument, a word to test if it's an isogram. This function should return a boolean indicating whether it is an isogram (true) or not (false). Example: isIsogram("Dermatoglyphics") Expected result: true

8th Jun 2018, 9:19 PM
Elvis Ekhator
Elvis Ekhator - avatar
3 Answers
+ 5
So if you want to know if word A is an isogram of word B, List out all the letters of A, then if you see the same letter in B, delete those 2 identical letters. Remember to preserve duplicates. There's part of the algorithm. Now code!
9th Jun 2018, 5:05 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 5
Not too sure how to say it in JS but in Python, def is_isogram(word): return len(word) == len(set(word))
9th Jun 2018, 5:22 AM
David Ashton
David Ashton - avatar
+ 3
Hi Elvis Ekhator , I believe you tried it first. Can you please show your work, so that we can help you to make it complete.
8th Jun 2018, 10:52 PM
Sachin Artani
Sachin Artani - avatar