下面程序的运行结果是( )。L=[1,2,3,4]s=0for i in L : s=s*i
A: 4321
B: 10
C: 24
D: 1234
A: 4321
B: 10
C: 24
D: 1234
举一反三
- 如下程序的输出结果是:s=’’ls = [1,2,3,4]for l in ls:s += str(l)print(s) A: 1,2,3,4 B: 4321 C: 4,3,2,1 D: 1234
- 下面程序段的运行结果是____。s = 1: sum = 0For i = 1 To 4 s = s * i sum = sum + sNext iPrint sum A: 24 B: 33 C: 10 D: 30
- 下面程序段的运行结果是______。 i=1;s=1;a=0; do{a=a+s*i;s=-s;i++;}while(i A: 2 B: -2 C: 3 D: 0
- 有如下程序段: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
- 写出下面程序的运行结果: s=0; for i=1:10 s=s+i; end s