My code does what it's suppose to do but the code is failing Pylint checks. After pasting my code into Pylint checker, it says that Too many branches (15/12) and its failed me on the Pylint checks.
How can this be cleaned up?
"""Docstring"""
import words
def nicer_englishify_word(word):
"""Docstring"""
wordx = word.lower()
wordy = ""
if wordx.endswith('moo'):
vowel = True
else:
vowel = False
if vowel == True:
wordy1 = wordx[-3] + wordx[:-3]
wordy2 = wordx[:-3]
if wordy1 in words.get_word_list():
wordy11 = True
else:
wordy11 = False
if wordy2 in words.get_word_list():
wordy22 = True
else:
wordy22 = False
if wordy11 == wordy22:
if wordy11 == True:
wordy = "sametrue"
else:
wordy = "samefalse"
else:
if wordy22 == False:
wordy = "[" + wordx[-3] + wordx[:-3] + "]"
else:
wordy = "[" + wordx[:-3] + "]"
if wordy == "sametrue":
wordy = wordx[-3] + wordx[:-3] + " or " + wordx[:-3]
wordy = "<" + wordy + ">"
if wordy == "samefalse":
wordy = wordx[-3] + wordx[:-3] + " or " + wordx[:-3]
wordy = "(" + wordy + ")"
else:
wordy = wordx[-3] + wordx[:-3]
return wordy
def nicer_englishify_sentence(sentence):
"""docstring"""
stringlist = sentence.split()
result = ""
for item in stringlist:
result = result + nicer_englishify_word(item) + " "
result = result[:-1]
return result
if
s anselse
s. That doesn't mean your code is wrong. pylint doesn't check for correctness. \$\endgroup\$elif
statements ? \$\endgroup\$