图 a | 图 b |
请回答下列问题:
f=open(" ",encoding="utf-8")
line=f.readline() #读取第一行,保存在字符串 line 中
pro,pub=0,0
while line:#当 line 非空
x=
t=int(line[3:])
if x=="A":
pro+=t
elif x=="B":
line=f.readline() # 继续读取一行
score=int(pro/5*0.6+pub/5*0.4)
grade=
print("推荐度为:","★"*grade)
mw = input('请输入:')
res=''
i=0; j=0; n=len(mw)
while j<n:
if i%2==0:
mw+=mw[i]
else:
res+=mw[i]
j+=1
i+=1
print(res)
若输入的内容为python,输出的结果为( )
n=int(input("请输入要查找的自幂数位数:"))
count=total=0
for i in range(1*10**(n-1),1*10**n):
a=i
while a>0:
total+=
a=a//10
if i==total:
count+=1
print(i)
print(str(n)+"位自幂数一共有"++"个")
图 a | 图 b |
请回答下列问题:
f=open("dc.txt",encoding="utf-8")
line=f.readline()
pro,pub=0,0
# 读取第一行,保存在字符串 line 中
while line: # 当 line 非空
x=
t=int(line[3:])
if x=="A":
pro+=t
line=f.readline() # 继续读取一行
score=int(pro/5*0.6+pub/5*0.4)
grade=
print("推荐度为:","★"*grade)
s="78.166.97.89."
n=len(s);c="";max=""
for i in range(n):
if "0"<=s[i]<="9":
c=s[i]+c
else:
if c>max:
max=c
c=""
print(max)
执行该程序后,输出的结果是( )
import random
a=[0]*6
for i in range(6):
a[i]=random.randint(1,10) #随机生成 1到 10范围内的整数
for i in range(5):
if i%2==0 and a[i]>a[i+1]:
a[i],a[i+1]=a[i+1],a[i]
else:
a[i]+=1
print(a)
执行该程序段后,a的值可能的是( )
s = "Li20An24K04ao" ; i = 0
while i < len( s ) :
if "A" <= s[ i ] <= "Z" :
s = s[ : i ] + s[ i + 1 : ]
elif "0" <= s[ i ] <= "9" :
s = s[ : i ] + str( ( int(s[ i ]) + 8 ) % 10 ) + s[ i + 1 : ]
else :
s = s[ : i ] + chr( ( ord( s[ i ] ) – 95 ) % 26 + 97 ) + s[ i + 1 : ]
i = i + 1
执行上述程序后,s的值为( )