题目内容

为统计符合条件“性别(gender)为男,且职业(occupation)为老师,且年龄(age)40以下”的人数,下面if语句中正确的是()。

A. if (gender="男" and age<40 and occupation="老师"):n+=1
B. if (gender=="男" and age<40 and occupation=="老师"): n+=1
C. if (gender=="男" and age<40 or occupation=="老师"): n+=1
D. if (gender="男" or age<40 or occupation="老师"): n+=1

查看答案
更多问题

在Python的if语句中,无论条件表达式结果的值是什么,Python会将其结果转换为( )和( )两种,称为布尔型的值。

A. 真(True)
B. 假(FALSE)
C. 数字
D. 字符串

程序的三种结构分为()

A. 顺序结构
B. 分支结构
C. 循环结构
D. 一般结构

下方程序的运行结果是:______a=4if a>5:b=a**2else:b=a**3print(b)

已知分段函数的要求:x>0时,y=1x=0时,y=0x<0时,y=-1阅读程序,并进行填空,实现分段函数功能x=int(input("请输入一个整数:"))if ____________:y=0elif x>0:y=1else:y=-1print(y)

答案查题题库