如果A为整数且|A|>=10,则打印“OK”,否则打印“Error”,表示这个条件的单行格式If语句是( )。
A: If Int(A)=A And Sqr(A)>=10 Then Print "OK" Else Print "Error"
B: If Fix(=a And Abs(>=10 Then Print "OK" E1se Print "Error"
C: If Iht(A)=A And(A>=10,A<=-10)Then Print "OK" Else Print "Error"
D: If Fix(A)=A And A>=10,And A<=-10 Then Print "OK" Else Print "Error"
A: If Int(A)=A And Sqr(A)>=10 Then Print "OK" Else Print "Error"
B: If Fix(=a And Abs(>=10 Then Print "OK" E1se Print "Error"
C: If Iht(A)=A And(A>=10,A<=-10)Then Print "OK" Else Print "Error"
D: If Fix(A)=A And A>=10,And A<=-10 Then Print "OK" Else Print "Error"
举一反三
- 下列程序:try: f=open("data.txt",'r')except ValueError: print("Error")else: print("OK")如果当前目录不存在data.txt文件,则输出( ) A: Error B: OK C: 程序运行异常而中断 D: 什么都不输出
- 想要使用while循环重复打印3次OK,下列代码正确的是? A: a = 0while a < 3: a += 1 print('OK') B: a = 0while a < 10: a += 1 print('OK') C: a = 0while a < 3: a += 1print('OK') D: a = 0while a < 3: print('OK')
- 以下程序的输出结果是:a =10b =1try:c=b//(b/a)print(except (IOError ,ZeroDivisionError):print( " calculation error" )else:print(" no error" )} A: calculation error B: no error C: 9.0 D: 9.0no error
- 在下列代码中,哪一个选项的print语句能够被执行? A: if 4 < 3: print('OK') B: if 4 == 3: print('OK') C: if 4 != 3: print('OK') D: if 3 = 3: print('OK')
- Which of the following are NOT valid if/else statements in Python, assuming x and y are defined appropriately: A: if x < y: print('foo') else: print('bar') B: if x < y and x > 10: print('foo') C: if x < y: print('foo'); print('bar'); print('baz') D: if x < y: print('foo') elif y < x: print('bar') else: print('baz')