下面代码输出的x的值为( ) x = 1 while x < 3: break x = x + 1 print(x)
A: 1
B: 2
C: 3
D: 4
A: 1
B: 2
C: 3
D: 4
A
举一反三
- 执行下面代码后,最后输出的x值为( ) x = 1 while x < 3: x = x + 2 print(x) A: 1 B: 2 C: 3 D: 4
- 下面代码的输出是什么? x = 0 while x < 4: x = x + 1 print("x is", x) A: x is 0 B: x is 1 C: x is 2 D: x is 3 E: x is 4
- 下面代码的输出结果是哪个选项?x = 0 if x < 4: x = x + 1 print("x is", x) A: x is 0 B: x is 1 C: x is 2 D: x is 3 E: x is 4
- 关于下面代码的叙述,正确的是哪一项?x=0while x<;10:x=x+1print(x,end=' ')if x>;3:break A: 代码编译异常 B: 输出:0 1 2 C: 输出:1 2 3 D: 输出:1 2 3 4
- 下列代码输出的结果是__________x = 0 while x < 4: x = x + 1print("x is", x) A: x is 0 B: 分别输出x is 1 x is 2 x is 3 x is 4 C: x is 3 D: x is 4
内容
- 0
关于下面代码的叙述,正确的是哪一项? x=0 while x<10: x+=1 print(x) if x>3: break
- 1
以下代码片段: x=2 x +=1 print(x) 显示的值为3。
- 2
以下程序的输出结果是__________。 x= 0 while x<6: if x%2==0: continue if x==4: break x+=1 print("x=",x)
- 3
请问下面代码是否会构成一个死循环? x = 9 while x: print(x) x -= 3 x += 1
- 4
代码运行后,x的值为( )x = 1while x < 3: x += 1else: x = 1 A: 3 B: 2 C: 1 D: 4