GESP Python 2级 2025.03
2025年春节有两件轰动全球的事件,一个是DeepSeek横空出世,另一个是贺岁片《哪吒2》票房惊人,入了全球票房榜。下面关于DeepSeek与《哪吒2》的描述成立的是( )。
《哪吒2》是一款新型操作系统
DeepSeek是深海钻探软件
《哪吒2》可以生成新的软件
DeepSeek可以根据《哪吒2》的场景生成剧情脚本
对整型变量N,如果它能够同时被3和5整除,则输出N是含有至少两个质因数 。如果用流程图来描述处理过程,则输出语句应该在哪种图形框中( )。
圆形框
椭圆形框
平行四边形框
菱形框
Python语句 print(3+3**(2-2)*3) 执行后输出的值是( )。
11
6
4
3
下面Python代码执行,其输出是( )。
a, b = 3,4
a == b
b == a
print(a,b)
3 4
3 3
4 4
4 3
求三色彩球的颜色。有数量无限的红(Red)绿(Green)蓝(Blue)三种彩球排成一行,每组先为5个红色球,随后3个绿色,最后为2个蓝色。每个球都有编号,从左到右依次为1,2,3……。输入整数代表编号,求该编号球的颜色。下面是Python代码的实现,正确说法是( )。
N = int(input())
remainder = N % 10 #remainder变量保存余数
if 1 <= remainder <= 5:
print("Red")
elif 6 <= remainder <= 8:
print("Green")
elif remainder == 9 or remainder == 0:
print("Blue")
将 elif remainder == 9 or remainder == 0: 修改为 else 效果相同
将 if 1 <= remainder <= 5: 修改为 if remainder <= 5: 效果相同
elif 6 <= remainder <= 8: 写法错误,应修改为 elif 6 <= remainder and remainder <= 8:
根据题意 remainder = N % 10 应修改为 remainder = N // 10
下面Python代码执行后其输出是( )。
tnt = 0
for i in range(10):
if i % 3:
tnt += 1
else:
tnt += 2
print(tnt)
18
17
16
14
下面Python代码执行后输出是( )。
for i in range(10, 0, -2):
break
print(i)
10
8
0
因为循环执行时会执行break语句而终止循环,因此i的值不确定
下面Python代码执行后输出是( )。
for i in range(10):
if i % 3 == 0:
continue
print("0", end = "#")
else:
print("1",end = "#")
0#0#0#0#0#0#
0#0#0#0#0#0#0#1#
0#0#0#0#1#
0#0#0#0#0#0#1#
下面Python代码执行后的输出是( )。
for i in range(5):
for j in range(i,0,-1):
print(j,end="-")
1-2-1-3-2-1-4-3-2-1-
1-2-1-3-2-1-4-3-2-1
0-0-1-0-1-2-0-1-2-3-
0-0-1-0-1-2-0-1-2-3
下面Python代码执行后,将输出能被2整除且除以7余数为2的数。下列选项不能实现的是( )。
for i in range(100):
if ________________:
print(i)
i % 2 == 0 and i % 7 == 2
not(i % 2) and i % 7 == 2
not(i % 2) and not(i % 7)
i % 2 != 1 and i % 7 == 2
