21、以下程序的输出结果是_
s=“LOVES”
print("{:^13}" .format(S))
A.LOVES
B.******** LOVES
C.LOW3******
D.L0VES
答案:D
[解析] 本题考查的是字符串输出格式化知识点,中“(:^13}” 表示输出的字符串长度为13,居中对齐,空白处用“” 填充。最后输出的是L0VE*,D项正确。
22、以下程序的输出结果是
a=3.6e-1
b=4.2e3
print(b-a)
A.4199.64
B.7.8e2
C.0.6e-4
D.4199.064
答案:A
[解析 ]程序中b=4200 , a=0.36 ,b-a=4199.64。 本题选择A选项。
23、以下代码的输出结果是
Is=[“apple”,“red”,“orange”]
def funC(a):
ls.append(a)
return
funC(“yellow”)
print(ls)
A.[]
B.[“apple”,“red”,“orange”]
C.[“yellow”]
D.[" apple",“red”,"orange ",“yellow”]
答案:D
[解析] 列表|s中有三个元素,函数funC(“yellow”) ,将yellow"传递给形参a,用append0方法将a中内容添加到列表|s中,最后返回,故最终的s=[" apple “,“red”,” orange ",’ yellow l].print([s),即将列表|s中的内容输出。