网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
假设以下程序的功能是:删除列表lst所有值为2的元素,则程序空白处应该填写_______________。 lst=[1,2,3,2,2,4,2,5] n=lst._________ for i in range(0,n): lst.remove(2) print(lst)
A.count('2')
B.count(2)
C.length()
D.index('2')
参考答案和解析
B
更多 “假设以下程序的功能是:删除列表lst所有值为2的元素,则程序空白处应该填写_______________。 lst=[1,2,3,2,2,4,2,5] n=lst._________ for i in range(0,n): lst.remove(2) print(lst)A.count('2')B.count(2)C.length()D.index('2')” 相关考题
考题
以下程序的输出结果是 ______。 Dim n(2,2), i, j As Integer For i = 0 To 2 For j = 0 To 2 n(i,j) = i + j Next j Next i For i = 0 To 1 For j = 0 To 1 n(i+ 1 ,j + 1) = n(i + 1,j + 1) + n(i, j) Next j Next i Print n(i, j)A.14B.0C.6D.值不确定
考题
The relation between the two paragraphs is that in the 2nd paragraph the author[A] challenges the viewpoint in the lst paragraph.[B] modifies his view expressed in the lst paragraph.[C] provides the reason for the argument in the lst paragraph.[D] further analyzes the issue discussed in the lst paragraph.
考题
有以下程序 main ( ) { int i,n=0; for (i=2 ;i<5;i++) { do { if (i%3) continue; n++; } while(!i); n++; } print f ( "n=%d\n" , n); } 程序执行后的输出结果是A.n=5B.n=2C.n=3D.n=4
考题
请读程序: include main( ) { int n[2],i,j,k; { for(i=0,i
请读程序: # include<srdio.h> main( ) { int n[2],i,j,k; { for(i=0,i<2;i + + )n[i]=0; k=2; for(i=0;i<k;i+ +) {for(j=0;j<k;j+ +)n[j]=n[i]+l; print{("%d\n",n[k]); } 上面程序片段输出结果是 ( )A.不确定的值B.3C.23D.1
考题
有以下程序 main() { int s=0, a=1, n; scanf ( "%d", n); do { s+=l; a=a-2; } while (a! =n); print f ( "%d\n" , s ); 若要使程序的输出值为2,则应该从键盘给n输入不敷出值是A.-1B.-3C.-5D.0
考题
执行以下两条语句后,lst的结果是1. lst = [3, 2, 1]2. lst.append(lst)()
A.[3, 2, 1, [3, 2, 1]]B.[3, 2, 1, […]],其中“…”表示无穷递归C.抛出异常D.[3, 2, 1, lst]
考题
以下程序是一个函数,功能是求二阶矩阵(m行n列矩阵)的所有靠外侧的各元素值之和。(本程序中二阶矩阵用一维数组来表示。)例如,矩阵为:3 0 0 32 5 7 31 0 4 2则所有靠外侧的各元素值之和为3+0+0+3+2+3+1+0+4+2=18。add(int m,int n,int arr[]){ int i,j,sum=0;for(i=0;ifor(j=0;jN;J++)sum=sum+ (7) ;for(j=0;jfor(i=1; (8) ;i++)sum=sum+arr[i*n+j];return(sum);}
考题
问答题列表文件.LST是在什么阶段产生的?列表文件.LST中有哪些内容?
热门标签
最新试卷