用if语句表示如下分段函数f(x),下面程序不正确的是()。f(x)=2x+1x>=1f(x)=3x/(x-1)x<1
A. if(x>=1):f=2*x+1f=3*x/(x-1)
B. if(x>=1):f=2*x+1if(x<1):f=3*x/(x-1)
C. f=2*x+1if(x<1):f=3*x/(x-1)
D. if(x<1):f=3*x/(x-1)else:f=2*x+1
查看答案
执行下列Python语句将产生的结果是( )i=1if(i): print(True)else:print(False)
A. 输出1
B. 输出True
C. 输出False
D. 编译错误
下面的if语句统计"成绩(score)优秀的男生以及不及格的男生”的人数,正确的语句是( )
A. if (gender=='男' and score<60 or score>=90): n+=1
B. if (gender=='男' and score<60 and score>=90): n+=1
C. if (gender=='男' and (score<60 or score>=90)): n+=1
D. if (gender=='男' or score<60 or score>=90): n+=1
执行下列的Python语句将产生的结果是()。x=2;y=2.0if(x==y): print("Equal")else:print("Not Equal")
A. Equal
B. NotEqual
C. 编译错误
D. 运行时错误
在下面的异常堆栈中,异常类型是:__________。Traceback (most recent call last):File "", line 1, in TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'