我正在尝试解决 this CodingBat问题:
Squirrels who like to party get together and smoke cigars. Such a party is only deemed successful when the number of cigars is between 40 and 60, on a weekday. On weekends, however, there is no upper bound on number of cigars. Write a function that returns True if the party with the given values was successful.
不幸的是,虽然我偶尔使用过 Python,但我对它的了解还不够好,无法理解为什么我的代码会因第 5 行的语法错误而失败:
def cigar_party(cigars, is_weekend):
if is_weekend:
if cigars >= 40:
return True
else if:
cigars >= 40 and cigars =< 60:
return True
else:
return False
我是一名优秀的程序员,十分优秀!