A.
B.
C.
D.
2024 M NOC v×Èq7iIñ Python ÏFׇ5
5"9
” 40 9s
” 100
†Ê5
» 1 5 †Ê5
/
ë¥ñ½öíKÖÌ/€¥
^
for a in range(10000):
time.sleep(10)
var = 1
while var == 1:
n = input(" ?A??
? ")
print(n)
var += 10
while True:
break
a = [3,-1,',']
for i in a[:]:
if 3 not in a:
break
» 2 5 †Ê5
³››/
ë}
’ª
{¥²T¹
ls = [6, 1, 8, 6, 9, 6]
n = len(ls)
for i in range(n):
for j in range(i+1,n):
if ls[j]>ls[i]:
tmp = ls[i]
ls[i] = ls[j]
ls[j] = tmp
print(ls)
A.
B.
C.
D.
A.
B.
C.
D.
A.
B.
C.
D.
A.
B.
C.
D.
[6,6,8,6,9,1]
[1,6,6,6,8,9]
[9,8,6,6,6,1]
ñ½pí
{
» 3 5 †Ê5
P¨3Åd93˜1Ï
Äñ3˜C¥Q
”˜L
‹¾A¥}
’
^
dic = {}
for c in 'an apple a day keeps the doctor away':
dic[c] = __________
print(dic)
dic[c]+1
dic.get(c)+1
dic.get(c,1)
dic.get(c,0)+1
» 4 5 †Ê5
/
ë¥}
’ž’¥
{
^
x = ['N','O','C']
for i in x:
x.append(i.lower())
print(x)
['n','o','c']
['N','O','C','n','o','c']
['N','O','C']
ñ½ÉÆ
µÖÌ
˵
{
» 5 5 †Ê5
/
ëñ½L
!o
{Æ 666 ž’¥
{
^
number = input()
str(number)
int(number)
print(number+number)
666
1332
666666
13321332
» 6 5 †Ê5
A.
B.
C.
D.
A.
B.
C.
D.
A.
B.
C.
D.
A.
B.
C.
D.
A.
Ê
®
U¥ python ЀÂ/}
’ñ½³›ª
{²T¹
m = 2
if m//3 != 0:
print(m,' ??) 3
?; ')
else:
print(m,' ?) 3
?; ')
2 ?$ 3œ"
m ‚?$ 3œ"
2 ‚?$ 3œ"
m ?$ 3œ"
» 7 5 †Ê5
X©3˜1 s='? an you ?an a ?an as a ?anner ?an?an a ?an' ¹$åÊ¥‡Ó¡ g
7X1¯ð¡ g
7ü³1
|3˜1Ï¥ '?' 9й3 'c' ?
LCƒñÿ?¥}
’
^
s = split('?')
s = split('?','c')
s = s.replace('c','?')
s = s.replace('?','c')
» 8 5 †Ê5
python Vr
T 8-3**2%5
-19
0
2
4
» 9 5 †Ê5
[/ñ½hÙ›²
ªöA
U¥
^
x, y, z = 10, 20, 40
x, y = z/x, z-y
z = x*y
print(z)
80.0
40.0
20.0
10.0
» 10 5 †Ê5
Python Ï
ʨ¿
3î
Û
Ӵ o
^
random
B.
C.
D.
A.
B.
C.
D.
A.
B.
C.
D.
A.
B.
C.
D.
A.
B.
C.
D.
A.
B.
math
os
sys
» 11 5 †Ê5
CµBñ ¹ data ¥3Å1¤o¹ 'name'
î‹¥´ž’¥}
’
^
data(name)
data('name')
data['name']
data.key('name')
» 12 5 †Ê5
V촒
ÍÉ›†½‹¾
P¨'ñ Python =Âf
”
sorted()
max()
abs()
sum()
» 13 5 †Ê5
X1 python Ïu 7ÓqÓqÁ@F¥=¸˜L
‹¾A¥
^
'r'
'w'
'a'
'x'
» 14 5 †Ê5
Python Ï[/'ñVr
T V[|3˜1 '123' Ï¥
Äñ3˜Ð¹‹¥ ASCII
’´i[
V™
TRí$
[ord(c) for c in '123']
[ascii(c) for c in '123']
[chr(c) for c in '123']
[str(c) for c in '123']
» 15 5 †Ê5
/
Python }
’
{Æ 5
H
{ 'Five' ¥
^
x = input()
if x==5:
print('Five')
x = input()
if x=5:
C.
D.
A.
B.
C.
D.
A.
B.
C.
D.
A.
B.
C.
D.
print('Five')
x = input()
if x=='5':
print('Five')
x = input()
if x='5':
print('Five')
» 16 5 †Ê5
³›/
ë}
’KÔ
{¥²T
^
m, n = 6, 88
def fn(n):
global m
m += 100
n = 100
return m
print(m,fn(n),n)
6 88 88
106 106 88
6 106 88
6 106 100
» 17 5 †Ê5
X©3˜1 s='Data Science' 4|†M 'Data' ¥Ê[
^
s[0:3]
s[:4]
s[5:]
s[1:4]
» 18 5 †Ê5
[/‚
‹¿ˆ ·vG
£8"9
ØFî†s¥
^
†
Ø
i%
eÅ
» 19 5 †Ê5
X©M
®´Â/[/Ê[ϲT¹ False ¥
^
A.
B.
C.
D.
A.
B.
C.
D.
A.
B.
A.
B.
A.
B.
x = 15
y = 12
x>0 and y<15
x<20 or y>15
not(x<20) and y==12
not(y!=12) or x <=15
» 20 5 †Ê5
Python ϥ
V V[]
Hiñ
” /
” V[T¹
V촒
Íi¥
^
3˜1
œ
”
V
[
û V[
‘5
» 21 5 ‘5
/
ë¥ñ½
{¥²T„ð3˜1B"
s = ' ?y?v?v?y
2024年NOC大赛软件创意编程(西瓜创客)Python初中组初赛模拟真题