Which of the following does not print the same sequence of numbers as the others?下列哪一个不打印与其他数字相同的数字序列?
A: X = 5while (X < 6): print(X) X = X + 1
B: X = 4while (X < 5): X = X + 1 print(X)
C: X = 5repeat: print( X) X = X + 1 until (X > 6)
A: X = 5while (X < 6): print(X) X = X + 1
B: X = 4while (X < 5): X = X + 1 print(X)
C: X = 5repeat: print( X) X = X + 1 until (X > 6)
举一反三
- 如下代码可以实现当输入6的时候输出x>5,输入4的时候输出 3<x<=5,输入1的时候输出x<=3 x = int(input()) if x>5: print("x>5") elif x>3: print("3<x<=5") print("x<=3")
- 声明一个变量为局部变量应该用( )。 A: Private Sub Command1 Click() n=5:x=1 Do X=X * I I=I + 1 Loop While I < n Print x End Sub B: Private Sub Command1_Click() n=5:X=1:I=1 Do X=X*I I=I + 1 Loop While I <n Print x End Sub C: Private Sub Command1_Click() n=5:X=1:I=1 Do X=X * I I=I + 1 Loop While I<=n Print X End Sub D: Private Sub Command1_Click() n=5:X=1:I=1 Do X=X * I I=I + 1 Loop While I>n Print X End Sub
- 下列说法不正确的是( )。知识点:全局变量 A: x = 5def fun(): x = 2 x = x * 3 print(x, end=' ')fun()print(x)程序无误,输出结果为6 5 B: x = 5def fun(): global x x = 2 x = x*3 print(x, end=' ')fun()print(x)程序无误,输出结果为6 6 C: x = 5def fun(): x = x * 3 print(x ,end=' ')fun()print(x)程序无误,输出的结果为15 15 D: x = 5def fun(): print(x, end=' ')fun()print(x)程序无误,输出的结果为5 5
- 如下代码可以实现当仅输入6的时候输出x=6,仅输入4的时候输出x=4,仅输入1的时候输出x=1x=int(input())if x>;=5:print("x=6")elifx>;=4:print("x=4")else:print("x=1")
- 以下程序的输出结果是__________。 x= 0 while x<6: if x%2==0: continue if x==4: break x+=1 print("x=",x)