首页计算机NCRE全国计算机二级二级Python > 国家二级Python(程序的控制结构)模拟试卷2
下面代码的输出结果是 sum=0 for i in range(0,100): if i%2==0: sum一=i else: sum+=i print(sum) 一49 49 50 一50
下面代码的输出结果是 for i in range(1,10,2): print(i.end=’’.’’) 1,3,5,7,9, 1,3, 1,4, 1,4,7,
下面代码的输出结果是 sum=1 for i in range(1,101): sum+=i print(sum) 5049 5050 5051 5052
下面代码的输出结果是 a=[] for i in range(2,10): count=0 for x in range(2,i一1): if i%x==0: count+=1 if count!=0: a.append(i) print(a) [3,5,7,9] [4,6,8,9,10] [2,3,5,7] [4,6,8,9]
下面代码的输出结果是 x2=1 for day in range(4,0,一1): x1=(x2+1)*2 x2=x1 print(x1) 46 94 190 23
下面代码的输出结果是 for num in range(2,10): if num>1: for i in range(2,num): if(num%i)==0: break else: print(num,end=’’,’’) 2,4,6,8,10 2,4,6,8 2,3,5,7 4,6,8,9
下面代码的输出结果是 for n in range(100,200): i=n//100 j=n//10%10 k=n%10 if n==i**3+j**3+k**3: print(n) 152 153 157 159
下面代码的输出结果是 a=2.0 b=1.0 s=0 for n in range(1,4): s+=a/b t=a a=a+b b=t print(round(s,2)) 5.17 3.5 6.77 8.39
下面代码的输出结果是 for a in[’’torch’’,’’soap’’,’’bath’’]: print(a) torch soap bath torch soap bath torch,soap,bath torch,soap,bath
下面代码的输出结果是 for a in’mirror’: print(a,end=’’’’) if a==’r’: break mi mir mirro mirror
下面代码的输出结果是 s=0 while(s<=1): print(’计数:’,s) s=s+1 计数:0 计数:1 计数:0 计数:1 出错
下面代码的输出结果是 s=1 while(s<=1): print(’计数:’,s) s=s+1 计数:0 计数:1 计数:0 计数:1 出错
下面代码的输出结果是 for i in[’’pop star’’]: pass print(i,end=’’’’) pop star 出错 无输出 popstar
给出下面代码: i=1 while i<6: j=0 while j
以下选项中描述错误的是 执行代码,输出九九乘法表 可使用While嵌套循环实现上面程序的功能 执行代码出错 内层循环i用于控制一共打印9行
下面代码的输出结果是 a=1.0 if isinstance(a,int): print(’’{}is int’’.format(a)) else: print(’’{}is not int’’.format(a)) 1.0 is not int 出错 无输出 1.0 is int
下面代码的输出结果是 a={} if isinstance(a,list): print(’’{} is list’’.format(a)) else: print(’’{}is{}’’.format(’’a’’,type(a))) 出错 a is 无输出 a is list
下面代码的输出结果是 a=[1,2,3] if isinstance(a,float): print(’’{}is float’’.format(a)) else: print(’’{}is not float’’.format(a)) 执行代码出错 a is [1,2,3]is not float a is float
给出下面代码: a=input(’’’’).split(’’,’’) if isinstance(a,list): print(’’{}is list’’.format(a)) else: print(’’{}is not list’’.format(a)) 代码执行时,从键盘获得1,2,3,则代码的输出结果是 1,2,3 is list 1,2,3 is not list 执行代码出错 [’1’,’2’,’3’]is list
给出下面代码: a=input(’’’’).split(’’,’’) x=0 while x

    相关试卷

    • 国家二级Python(简单应用题)模拟试卷5

    • 国家二级Python(综合应用题)模拟试卷4

    • 国家二级Python(简单应用题)模拟试卷4

    • 国家二级Python(综合应用题)模拟试卷3

    • 国家二级Python(简单应用题)模拟试卷3

    • 国家二级Python(函数和代码复用)模拟试卷2

    • 国家二级Python(组合数据类型)模拟试卷2

    • 国家二级Python(程序的控制结构)模拟试卷2

    • 国家二级Python(Python计算生态)模拟试卷2

    • 国家二级Python(Python语法基础)模拟试卷2

    • 国家二级Python(综合应用题)模拟试卷2

    • 国家二级Python(基本数据类型)模拟试卷2

    • 国家二级Python(基本编程题)模拟试卷2

    • 国家二级Python(文件和数据格式化)模拟试卷2

    • 国家二级Python(简单应用题)模拟试卷2

    • 国家二级Python(Python基础生态)模拟试卷2

    • 国家二级Python(函数和代码复用)模拟试卷1

    • 国家二级Python(数据库设计基础)模拟试卷1

    • 国家二级Python(Python基础生态)模拟试卷1

    • 国家二级Python(数据结构与算法)模拟试卷1