+ 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'.
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.
+ 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
+ 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))
+ 1
Thanks alot I really appreciate your efforts. I'm trying it now
+ 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.
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
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.
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
0
If word was Moose, the code would return ('moose', False)
0
Anytime! Enjoy.
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