7.2(中)下面程序的运行结果是: i = 1 while i < 10: print(i) i=i+1
举一反三
- 下面代码中输出结果为1,2,3三个数字的有()。 A: for i in range(3): print(i) B: alist=[0,1,2] for i in alist: print(i+1) C: i=1 while i<3: print(i) i+=1 D: for i in range(3,0,-1): print(i+1) E: i=3 while i>0: i=i-1 print(3-i)
- 下面程序的运行结果是( )。 DIMENSION ad(10) i=1 S=0 DO WHILE i<=10 ad(i)=i一1 s=s+ad(i) i=i+1 ENDD0 S A: 40 B: 45 C: 50 D: 55
- 下面代码中输出结果为3,2,1三个数字的有()。 A: alist=[3,2,1] for i in alist: print(i) B: i=3 while i>0: print(i) i=i-1 C: for i in range(3,0,-1): print(i) D: for i in range(3): print(i) E: i=1 while i<3: print(i) i=i+1
- 执行以下语句的结果是________ i = 1 a = 0 while i<=5: i=i+1 a=a+i print(a)
- 有如下程序段:s = 0For i = 1 To 10 s = s + iNext iPrint s与上述程序段输出结果相同的程序段为( )。 A: s = 0: i = 0 While i <= 10 i = i + 1 s = s + i Wend Print s B: s = 0: i = 1 While i < 10 i = i + 1 s = s + i Wend Print s C: s = 0: i = 1 Do s = s + i i = i + 1 Loop While i < 10 Print s D: s = 0: i = 1 Do s = s + i i = i + 1 Loop Until i > 10 Print s