• 2022-06-12
    关于下面代码的叙述,正确的是哪一项?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
  • D

    内容

    • 0

      ‌下面代码的输出结果是哪个选项?​‌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

    • 1

      下列代码输出的结果是__________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

    • 2

      a = &#91;x for x in range(4) if x % 2 ==1&#93;,语句print(a)输出为 A: [1, 2, 3] B: [0, 1, 2, 3] C: [0, 2] D: [1, 3]

    • 3

      关于下面代码的叙述,正确的是哪一项? A: 代码编译异常 B: 输出:0 1 2 C: 输出:1 2 3 D: 输出:1 2 3 4

    • 4

      以下代码的输出结果是x = 2def func(): global x x = 1 return xfunc()print(x) A: 0 B: 1 C: 2 D: 3