我正在學習CS常見考試,我正在做一些練習測試。我無法理解爲什麼這個問題返回「=」而不是「假」。我真的不明白Python編程多選
splitLine = aStr.split()
def mostlyLongWords(aStr, threshold):
splitLine = aStr.split()
shortCount = 0
longCount = 0
for word in splitLine:
if len(word) < threshold:
shortCount += 1
else:
longCount += 1
if shortCount > longCount:
return False
if longCount > longCount:
return True
return '='
seussLine = 'There is no one alive who is you-er than you'
print(mostlyLongWords(seussLine, 5))
a。真
b。假
c。 d =
d。語法錯誤:不兼容返回類型
e。以上都不是
它向我返回False – 2014-09-28 20:13:33
它會返回'False'嘗試執行它 – 2014-09-28 20:14:45
您在第一行定義'aStr'的地方。如果刪除第一行也爲我返回'False'。 – 2014-09-28 20:16:25