+ 1

Create a method called is_isogram that takes one argument, a word to test of it's an isogram.

This method should return a tuple of the word & a boolean indicating whether its an isogram.

15th Mar 2017, 8:01 PM
Kenny Moses
Kenny Moses - avatar
13 ответов
+ 8
anyway, here's my solution for it 1) make it case-insensitive by converting to lowercase 2) build a list of letter counts 3) return True if the set of those letter counters is 1, else, return False 4) ????? 5) profit def is_isogram(word): # convert word to lower case word=word.lower() return len(set([word.count(letter) for letter in word]))==1
15th Mar 2017, 10:56 PM
Burey
Burey - avatar
+ 6
@Justin while being a nice solution that implementation will work for one occurance only (as you stated yourself). as an isogram can have a letter repeat multiple times (as long as ALL the letters repeat the same amount as well) that implementation won't work for the latter cases
15th Mar 2017, 10:40 PM
Burey
Burey - avatar
+ 6
"a word or phrase without a repeating letter. It is also used by some to mean a word or phrase in which each letter appears the same number of times, not necessarily just once." go figure hehe
15th Mar 2017, 10:48 PM
Burey
Burey - avatar
+ 6
seems you are right about the examples hehe every word with no letter repeats
15th Mar 2017, 10:52 PM
Burey
Burey - avatar
+ 5
Tell us what have you do to solve the problem, and in what part you are not understanding so that we can help you solve the problem and not solve it for you.
15th Mar 2017, 8:24 PM
Ulisses Cruz
Ulisses Cruz - avatar
+ 5
from wikipedia: "An isogram (also known as a "nonpattern word") is a logological term for a word or phrase without a repeating letter. It is also used by some to mean a word or phrase in which each letter appears the same number of times, not necessarily just once. Conveniently, the word itself is an isogram in both senses of the word, making it autological." edit: possible solution in my codes edit #2: discovered an error in my implementation, all fixed now xD
15th Mar 2017, 9:01 PM
Burey
Burey - avatar
30th Aug 2017, 7:09 PM
Krafty Coder
Krafty Coder - avatar
+ 1
your right, I will add a check for equal amount of letters after I eat. I just find it hard to believe an isogram can be both a word with no repeating letters and also be a word with equal repeaters. seems like one or the other is wrong
15th Mar 2017, 10:42 PM
LordHill
LordHill - avatar
+ 1
every example (there are alot) that wiki provides are for no repeats
15th Mar 2017, 10:46 PM
LordHill
LordHill - avatar
+ 1
thanks y'all, solved the problem
16th Mar 2017, 12:39 PM
Kenny Moses
Kenny Moses - avatar
0
def isoCheck(x): iso=[] for i in x: if i in iso: return "No " + x +" is NOT an isogram" else: iso.append(i) return "Yes, " + x + " is an isogram" run=True while run == True: isogram=input("\nEnter Word To Check-\n") print(isoCheck(isogram)) My codes are never people's favorite way to do things, but they work. Assuming an isogram is a word with no repeating letters, my function isoCheck() does the trick
15th Mar 2017, 10:33 PM
LordHill
LordHill - avatar
0
def isIso(word): word = word.lower() multi_true = len(word)/len(set(word))==int(len(word)/len(set(word))) single_true = len(set(word))==len(word) return(word,single_true or multi_true)
16th Mar 2017, 1:48 AM
richard