+ 2

What's the problem of my code? Let me know that. Thanks!

word = str(input()) def isogram(): if word = isogram: print(True) else: print(False) isogram()

29th Apr 2022, 5:02 PM
Hani
Hani - avatar
3 Answers
+ 5
Input returns a string so you don't need str( ). If requires a condition. Use == instead of = Isogram is a function. word is a string. Try to print Isogram to see the result, it helps you to understand your code.
29th Apr 2022, 5:13 PM
Stefanoo
Stefanoo - avatar
+ 3
Hani , here the definition what makes a text an isogram: an isogram is a word that has no repeating consecutive or non-consecutive letters. so we have to make a function that gets a string, checks if there are duplicated letters or not. then it should return the result to the caller of the function, or the message could also be printed from inside the function. how can we check for isogram: - we use the input text, create a set of it, and compare the length of the original text against the length of the set. if both values are the same, no duplicated letters are in the string. or: - we can use a for loop running over the characters of the text and use the count() method to get the number of occurrence from each letter.
29th Apr 2022, 7:39 PM
Lothar
Lothar - avatar
+ 2
Also it’s requires indentation after def stament. E.g word=input() def isogram(x): if word ==x: print(“True”) else: print(“False”)
29th Apr 2022, 10:32 PM
Semih ÖztĂŒrk