如何使用以下信息使用Python创建代码?

2024-05-16 18:08:56 发布

您现在位置:Python中文网/ 问答频道 /正文

面包师聚会时,他们喜欢吃糕点。面包师的聚会是成功的 糕点的数量在40到60之间,包括在内。除非是周末,在这种情况下 糕点的数量没有上限。使用功能设计配方开发 功能名为面包师党。该函数有两个参数。第一个论点是 糕点数(整数)。如果是周末,第二个论点是正确的;如果是周末,第二个论点是错误的 白天是工作日。如果具有给定参数的参与方成功,则函数返回True, 否则它将返回False


Tags: 函数功能true参数数量错误配方情况
1条回答
网友
1楼 · 发布于 2024-05-16 18:08:56
def bakers_party(no_pastr,weekend):
    """ <Return whether the baker's party will be successful.>
    @type no_pastr : int, weekend : bool
    @rtype bool
    """
    if not weekend and no_pastr >= 40 and <= 60:
        return True
    elif weekend and no_pastr >= 40:
        return True        
    else:
        return False

好了。希望你取得好成绩

相关问题 更多 >