def cat_latin_word(text):
"""converts the english into cat latin"""
constant = "bcdfghjklmnprstvwxyzBCDFGHJKLMNPQRSTVWXYZ"
result = []
for word in text.split():
if word[0] in constant:
word = (str(word)[1:] + str(word)[0] + "eeoow")
result.append(word)
elif word == "q":
word = ("oodbyegeeoow")
result.append(word)
else:
word = (str(word) + "meeoow")
result.append(word)
return ' '.join(result)
def cat_latin_from_sentence(text):
"""call the sub cat latin word sub function"""
return cat_latin_word(text)
def main():
"""Calling for the main function"""
text = input("Enter the english sentence: ")
print("cat latin =" + " "+ cat_latin_from_sentence(text))
我不得不在这里猜测一下你没有张贴实际的Pylint
消息,但它是否可能抱怨你特别错过了module docstring?也就是说,文件顶部的docstring
描述了整个模块的用途,而不是你所展示的函数级docstrings
。