+ 1

I'm working on a project please can anyone help me with the right code for this

Create a method called is_isogramthat takes one argument, a word to test if it's an isogram. This method should return a tuple of the word and a boolean indicating whether it is an isogram. If the argument supplied is an empty string, return the argument and False: (argument, False). If the argument supplied is not a string, raise a TypeError with the message 'Argument should be a string'.

11th Mar 2017, 7:02 AM
ayuba
11 Respuestas
+ 5
Hello. I'm not an expert about answering questions but I thing it would be better to help the person get to the answer and not give him the answer without knowing if he is even trying it by himself. Nothing agains you ayuba.
11th Mar 2017, 4:08 PM
Ulisses Cruz
Ulisses Cruz - avatar
+ 1
def is_isogram(word): if isinstance(word, str) == False: raise TypeError ("Argument Should be a string") word = word.lower() if word == "": return word, False for char in word: if word.count(char) > 1: return word, False return word, True
11th Mar 2017, 8:25 AM
Martian1oh1
Martian1oh1 - avatar
+ 1
If you want to play around with it, copy-paste the following code into the code playground. When you run it, you'll be asked for input. The word will be whatever you input. word = input() def is_isogram(word): if isinstance(word, str) == False: raise TypeError ("Argument Should be a string") word = word.lower() if word == "": return word, False for char in word: if word.count(char) > 1: return word, False return word, True print(is_isogram(word))
11th Mar 2017, 8:44 AM
Martian1oh1
Martian1oh1 - avatar
+ 1
Thanks alot I really appreciate your efforts. I'm trying it now
11th Mar 2017, 8:50 AM
ayuba
+ 1
@Ulisses Cruz Personally I've never agreed with that unless the poster specifically asks to be walked through it or specifically asks for guidance. Although I do see where you're coming from.
11th Mar 2017, 7:15 PM
Martian1oh1
Martian1oh1 - avatar
0
please Martian I will need more help from you. please can I add you up on Facebook so we can talk better. please add me up on Facebook Ajuwon Ayuba or my WhatsApp contact +2349054012685
11th Mar 2017, 8:27 AM
ayuba
0
I'm sorry, but I don't use Facebook or WhatsApp. I'll gladly attempt to answer any additional question you may have here.
11th Mar 2017, 8:30 AM
Martian1oh1
Martian1oh1 - avatar
0
please can you insert a word in the string, just a word from your own mind and let me see how it look like
11th Mar 2017, 8:39 AM
ayuba
0
If word was Moose, the code would return ('moose', False)
11th Mar 2017, 8:40 AM
Martian1oh1
Martian1oh1 - avatar
0
Anytime! Enjoy.
11th Mar 2017, 8:57 AM
Martian1oh1
Martian1oh1 - avatar
0
he decide to help me out on a problem have been trying to solve more than 12hours. I don't see anything bad in that. Martian thanks so much for your time
11th Mar 2017, 7:22 PM
ayuba