Construct an algorithm and write a python to create a regular expression to retrieve marks and names from a given string or files. Extract only marks having 2 digits and names starting with capital letter. A word is called as a good word if all the letters of the word are distinct. That is, all the letters of the word are different from each other letter. Else, the word is called as a bad word. Write an algorithm and the subsequent Python code to check if the given word is good or bad.: e.g. START, GOOD, BETTER are bad: WRONG is good! Make the comparison to be case insensitive.
word = input('')
word = word.lower()
length = len(word)
count=0
for i in range(0,length):
for j in range(0,length):
if word[i]==word[j]:
count+=1
if count==len(word):
print('Good')
else:
print('Bad')
Comments
Leave a comment