# 请在______处使用一行代码或表达式替换# 注意:请不要修改其他已给出代码
s =input("请输入一个字符串:")
print("{______}".format(s))
【参考代码】
# 请在______处使用一行代码或表达式替换# 注意:请不要修改其他已给出代码
s =input("请输入一个字符串:")
print("{:=^20}".format(s))
第 9 套题
【题目素材】
# 请在...处使用一行或多行代码替换# 注意:请不要修改其他已给出代码
n =eval(input("请输入数量:"))......print("总额为:",cost)
【参考代码】
# 请在...处使用一行或多行代码替换# 注意:请不要修改其他已给出代码
n =eval(input("请输入数量:"))
if n ==1: cost = n *160elif n <=4: cost = n *160*0.9elif n <=9: cost = n *160*0.8else: cost = n *160*0.7print("总额为:",cost)
第 10 套题
【题目素材】
# 请在______处使用一行代码或表达式替换# 注意:请不要修改其他已给出代码
a, b =0,1while ______:
print(a, end=',')
a, b = ______
【参考代码】
# 请在______处使用一行代码或表达式替换# 注意:请不要修改其他已给出代码
a, b =0,1while a<=100:
print(a, end=',')
a, b = b, a + b
第 11 套题
【题目素材】
# 请在______处使用一行代码或表达式替换# 注意:请不要修改其他已给出代码
a =[3,6,9] b =eval(input())#例如:[1,2,3] ______ for i in ______: s += a[i]*b[i]print(s)
【参考代码】
# 请在______处使用一行代码或表达式替换# 注意:请不要修改其他已给出代码
a =[3,6,9] b =eval(input())#例如:[1,2,3]
s =0for i inrange(3):
s += a[i]*b[i]
print(s)
第 12 套题
【题目素材】
# 请在______处使用一行代码或表达式替换# 注意:请不要修改其他已给出代码import random ______ for i inrange(______):print(______, end=",")
【参考代码】
# 请在______处使用一行代码或表达式替换# 注意:请不要修改其他已给出代码import random
random.seed(123)
for i inrange(10):
print(random.randint(1,999), end=",")
第 13 套题
【题目素材】
# 请在______处使用一行代码或表达式替换# 注意:请不要修改其他已给出代码
n =eval(input("请输入正整数:"))
print("{______}".format(n))
【参考代码】
# 请在______处使用一行代码或表达式替换# 注意:请不要修改其他已给出代码
n =eval(input("请输入正整数:"))
print("{:*>15}".format(n))
第 14 套题
【题目素材】
# 请在______处使用一行代码或表达式替换# 注意:请不要修改其他已给出代码
a =[3,6,9] b =eval(input())#例如:[1,2,3] c =[]for i inrange(___(1)___): c.append(___(2)___)
print(c)
【参考代码】
# 请在______处使用一行代码或表达式替换# 注意:请不要修改其他已给出代码
a =[3,6,9] b =eval(input())#例如:[1,2,3]
c =[]
for i inrange(len(b)): c.append(a[i]+b[i])
print(c)
第 15 套题
【题目素材】
# 请在______处使用一行代码或表达式替换# 注意:请不要修改其他已给出代码import random ___(1)___ s =0for i inrange(5): n = random.randint(___(2)___)# 产生随机数 s = ___(3)___ print(s)
【参考代码】
# 请在______处使用一行代码或表达式替换# 注意:请不要修改其他已给出代码import random
random.seed(0)
s =0for i inrange(5): n = random.randint(1,97)# 产生随机数 s = s +pow(n,2)print(s)
第 16 套题
【题目素材】
# 请在______处使用一行代码或表达式替换# 注意:请不要修改其他已给出代码
n =eval(input("请输入正整数:"))
print("{______}".format(n))
【参考代码】
# 请在______处使用一行代码或表达式替换# 注意:请不要修改其他已给出代码
n =eval(input("请输入正整数:"))
print("{:=^14}".format(n))
第 17 套题
【题目素材】
# 请在______处使用一行代码或表达式替换# 注意:请不要修改其他已给出代码
a =[3,6,9] b =eval(input())#例如:[1,2,3] j=1for i inrange(len(__(1)____)): b._____(2)_____ j+= __(3)______ print(b)
【参考代码】
# 请在______处使用一行代码或表达式替换# 注意:请不要修改其他已给出代码
a =[3,6,9] b =eval(input())#例如:[1,2,3]
j=1for i inrange(len(a)): b.insert(j,a[i]) j+=2print(b)
第 18 套题
【题目素材】
# 请在______处使用一行或多行代码替换# 注意:请不要修改其他已给出代码import random ____________ # 此处可多行 s =0# ____________ # 此处可多行print(s)
【参考代码】
# 请在______处使用一行或多行代码替换# 注意:请不要修改其他已给出代码import random
random.seed(100)# 此处可多行 s =0# for i inrange(3):# 此处可多行 s = s +pow(random.randint(1,9),3)print(s)
第 19 套题
【题目素材】
#请完善如下代码 s =input()print("{_______(1)_________}".format(_______(2)_________))
【参考代码】
#请完善如下代码 s =input()print("{:=>25,}".format(eval(s)))
第 20 套题
【题目素材】
#请完善如下代码 s =input()print(_______(1)_________)
print(_______(2)_________)
【参考代码】
#请完善如下代码 s =input()print(s[::-1],end="")
print(len(s))
第 21 套题
【题目素材】
#请完善如下代码 a, b, c = _______(1)_________ ls =[]for i inrange(c): ls._______(2)_________ print(ls)
【参考代码】
#请完善如下代码 a, b, c =eval(input()) ls =[]for i inrange(c): ls.append(a+b*i)
print(ls)
第 22 套题
【题目素材】
#请完善如下代码,不得修改其他代码#PY101.py s =input()print("{_______(1)_________}".format(_______(2)_________))
【参考代码】
#请完善如下代码,不得修改其他代码#PY101.py s =input()print("{:"^30x}".format(eval(s)))
第 23 套题
【题目素材】
#请完善如下代码,不得修改其他代码#在________处填写一行或多行代码#PY102.py n =input() s ="〇一二三四五六七八九"for c in"0123456789": _______(1)_________ print(n)
【参考代码】
#请完善如下代码,不得修改其他代码#在________处填写一行或多行代码#PY102.py n =input() s ="〇一二三四五六七八九"for c in"0123456789": n = n.replace(c,s[int(c):int(c)+1])
print(n)
第 24 套题
【题目素材】
#请完善如下代码,不得修改其他代码#PY103.py a, b, c = _______(1)_________ ls =[]for i inrange(c): _______(2)_________ print(",".join(ls))
【参考代码】
#请完善如下代码,不得修改其他代码#PY103.py a, b, c =eval(input()) ls =[]for i inrange(c): ls.append(str(a*(b**i)))
print(",".join(ls))
第 25 套题
【题目素材】
## 在____________上补充代码# num =input().____________ for i in num:print(____________)
【参考代码】
## 在____________上补充代码# num =input().split(",")for i in num:
print("{:>10}".format(i),end="")
第 26 套题
【题目素材】
## 在____________上补充代码# scale =0.0001# 成就值增量
defcalv(base, day): val = base *pow(____________)
return val print('5 年后的成就值是{}'.format(int(calv(1,5*365)))) year =1while calv(1, ____________)<100: year +=1print('{}年后成就值是 100'.format(year))
【参考代码】
## 在____________上补充代码# scale =0.0001# 成就值增量
defcalv(base, day): val = base *pow((1+scale),day*11)
return val print('5 年后的成就值是{}'.format(int(calv(1,5*365)))) year =1while calv(1, year*365)<100: year +=1print('{}年后成就值是 100'.format(year))
第 27 套题
【题目素材】
## 在____________上补充代码#whileTrue:try: a =eval(input('请输入一个正整数:'))
if a >0and ____________:
print(a) ____________ else:print("请输入正整数")
except:print("请输入正整数")
【参考代码】
## 在____________上补充代码#whileTrue:try: a =eval(input('请输入一个正整数:'))
if a >0and a %1==0:
print(a)
breakelse:print("请输入正整数")
except:print("请输入正整数")
第 28 套题
【题目素材】
## 在____________上补充代码# n =input('请输入一个正整数:')for i inrange(____________):
print('____________'.format(i, ____________))
【参考代码】
## 在____________上补充代码# n =input('请输入一个正整数:')for i inrange(1,eval(n)+1):
print('{:0>2}{}{}'.format(i," ",">"*(i)))
第 30 套题
【题目素材】
## 在____________上补充代码# std =[['张三',90,87,95],['李四',83,80,87],['王五',73,57,55]] modl ="亲爱的{}, 你的考试成绩是:英语{}, 数学{}, Python 语言{}, 总成绩{}.特此通知."for st in std: cnt = ____________ for i inrange(____________): cnt += ____________ print(modl.format(st[0],st[1],st[2],st[3],cnt))
【参考代码】
## 在____________上补充代码# std =[['张三',90,87,95],['李四',83,80,87],['王五',73,57,55]] modl ="亲爱的{}, 你的考试成绩是:英语{}, 数学{}, Python 语言{}, 总成绩{}.特此通知."for st in std: cnt =0for i inrange(1,4): cnt += st[i]
print(modl.format(st[0],st[1],st[2],st[3],cnt))
第 31 套题
【题目素材】
## 在____________上补充代码# s =input("请输入一个正整数:") ____________ for c in s: cs += ____________ print('{____________}'.format(cs))
【参考代码】
## 在____________上补充代码# s =input("请输入一个正整数:") cs =0for c in s: cs +=int(c)
print('{:=^25}'.format(cs))
第 32 套题
【题目素材】
## 在____________上补充代码# s =input("请输入中文和字母的组合:") ____________ for c in s:if ____________: count +=1print(count)
【参考代码】
## 在____________上补充代码# s =input("请输入中文和字母的组合:") count =0for c in s:
if"\u4e00"<= c <="\u9fff": count +=1print(count)
第 33 套题
【题目素材】
## 在____________上补充代码# s =input("请输入一组数据:") ls = ____________ lt =[]for i in ls: lt.append(____________)
print(max(lt))
【参考代码】
## 在____________上补充代码# s =input("请输入一组数据:") ls = s.split(",") lt =[]for i in ls: lt.append(eval(i))
print(max(lt))
第 34 套题
【题目素材】
## 在____________上补充代码# s =input("请输入一个小数:") s = s[::-1] ____________ for c in s:if c =='.': ____________ cs +=eval(c)
print('{____________}'.format(cs))
【参考代码】
## 在____________上补充代码# s =input("请输入一个小数:") s = s[::-1] cs =0for c in s:
if c =='.':break
cs +=eval(c)
print('{:*>10}'.format(cs))
第 35 套题
【题目素材】
## 在____________上补充代码#import time t =input("请输入一个浮点数时间信息:") s = time.ctime(____________) ls = s.split()print(____________)
【参考代码】
## 在____________上补充代码#import time t =input("请输入一个浮点数时间信息:") s = time.ctime(eval(t)) ls = s.split()print(ls[3].split(":")[0])
第 36 套题
【题目素材】
## 在____________上补充代码#import random s =input("请输入随机种子:") ls =[]for i inrange(26): ls.append(chr(ord('a')+i))
for i inrange(10): ls.append(chr(____________) random.____________(eval(s))
for i inrange(10):for j inrange(____________):print(random.choice(ls),end='')
print()
【参考代码】
## 在____________上补充代码#import random s =input("请输入随机种子:") ls =[]for i inrange(26): ls.append(chr(ord('a')+i))
for i inrange(10): ls.append(chr(ord('0')+i)) random.seed(eval(s))
for i inrange(10):for j inrange(8):print(ls[random.randint(0,35)],end='')
print()
第 37 套题
【题目素材】
## 在____________上补充代码# ls =eval(input()) s =""for item in ls:
if ___(1)_____ ==type("香山"): s += ___(2)_____ print(s)
【参考代码】
## 在____________上补充代码# ls =eval(input()) s =""for item in ls:
iftype(item)==type("香山"): s += item
print(s)
第 38 套题
【题目素材】
## 在____________上补充代码#import random random.seed(25) n = ___________(1)____________ for m inrange(1,7): x =eval(input("请输入猜测数字:"))if x == n:print("恭喜你,猜对了!")
breakelif ___________(2)___________:print("大了,再试试")
else:print("小了,再试试")
if ___________(3)___________:print("谢谢!请休息后再猜")
【参考代码】
## 在____________上补充代码#import random random.seed(25) n = random.randint(1,101)for m inrange(1,7): x =eval(input("请输入猜测数字:"))
if x == n:print("恭喜你,猜对了!")
breakelif x > n:print("大了,再试试")
else:print("小了,再试试")
if m ==6:print("谢谢!请休息后再猜")
第 39 套题
【题目素材】
## 在____________上补充代码#deff(n): ___________(1)___________ if ___________(2)___________:for i inrange(1, n+1,2): s +=1/i else:for i inrange(2, n+1,2): s +=1/i return s n =int(input())
print(___________(3)___________)
【参考代码】
## 在____________上补充代码#deff(n): s =0if n %2==1:
for i inrange(1, n+1,2): s +=1/i
else:
for i inrange(2, n+1,2): s +=1/i
return s n =int(input())
print("{:.2f}".format(f(n)))
第 40 套题
【题目素材】
## 编写代码替换横线# n =eval(input("请输入一个整数:"))for i inrange(1,n):
for j inrange(1,n):
if ______(1)_____________: ______(2)___________ print()
【参考代码】
## 编写代码替换横线# n =eval(input("请输入一个整数:"))for i inrange(1,n):
for j inrange(1,n):
if i <= j < n:
print(j, end =" ")
print()
第 41 套题
【题目素材】
## 编写代码替换横线# s =input("请输入 5 个小写字母:") ___________(1)____________ print(','.join(_____(2)______))
【参考代码】
## 编写代码替换横线# s =input("请输入 5 个小写字母:") s = s.upper()print(','.join(s[::-1]))
第 42 套题
【题目素材】
## 编写代码替换横线#import random __________(1)_______________ random.seed(100)for i inrange(1,11):
if i<10:print(___________(2)_________)
else:print(random.randint(1,n))
【参考代码】
## 编写代码替换横线#import random n =eval(input()) random.seed(100)for i inrange(1,11):
if i<10:print(random.randint(1,n), end =',')
else:print(random.randint(1,n))
第 43 套题
【题目素材】
## 编写代码替换横线# a =input("请输入填充符号:") s ="PYTHON"print("{_____(1)____}".format(_____(2)____))
【参考代码】
## 编写代码替换横线# a =input("请输入填充符号:") s ="PYTHON"print("{0:{1}^30}".format(s,a))
第 44 套题
【题目素材】
## 编写代码替换横线# myinput =input("请输入:") ls = ______(1)___________ s =0for c in ls:
if c.strip(" ").isdigit(): ________(2)_______ print("数字和是:"+str(s))
【参考代码】
## 编写代码替换横线# myinput =input("请输入:") ls = myinput.split(',') s =0for c in ls:
if c.strip(" ").isdigit(): s +=eval(c)
print("数字和是:"+str(s))
第 45 套题
【题目素材】
## 请完善代码# ______(1)_______ ls =[]for line in f:
for c in line:
if ______(2)_______: ls.append(c) f.close()
print(len(ls))
附件:data103.txt
【参考代码】
## 请完善代码# f =open('data.txt','r') ls =[]for line in f:
for c in line:
if c notin ls: ls.append(c) f.close()
print(len(ls))
第 46 套题
【题目素材】
## 在____________上补充代码(12 根短线)#不要修改其他代码# f =eval(input("请输入一个浮点数:"))print("浮点数是:{_____(1)_______}".format(f))
【参考代码】
## 在____________上补充代码(12 根短线)#不要修改其他代码# f =eval(input("请输入一个浮点数:"))print("浮点数是:{:>10.2f}".format(f))
第 47 套题
【题目素材】
## 在____________上补充代码(12 根短线)#不要修改其他代码# h,w =eval(input("请输入起始英文字母的序号和连续输出的个数,逗号隔开:")) cstr =''for i inrange(_______(1)_________): c = _________(2)____________ cstr += c print(cstr)
【参考代码】
## 在____________上补充代码(12 根短线)#不要修改其他代码# h,w =eval(input("请输入起始英文字母的序号和连续输出的个数,逗号隔开:")) cstr =''for i inrange(w): c =chr(97+h+i) cstr += c print(cstr)
第 48 套题
【题目素材】
# 请在......处完善代码,可以修改其他代码import random as r r.seed(1) s=input("请输入三个整数 n,m,k:") slist=s.split(",") ……
【参考代码】
# 请在......处完善代码,可以修改其他代码import random as r r.seed(1) s=input("请输入三个整数 n,m,k:") slist=s.split(",")
for i inrange(eval(slist[0])):print(r.randint(eval(slist[2]),eval(slist[1])))
第 49 套题
【题目素材】
sinfo=input() _________(1)__________ print("姓名,年龄")
for _________(2)__________ sname=strname[:-2] _________(3)__________ print("{},{}".format(sname,sage))
【参考代码】
sinfo=input() s = sinfo.split(",")
print("姓名,年龄")
for strname in s: sname=strname[:-2] sage=strname[-2:]
print("{},{}".format(sname,sage))
第 50 套题
【题目素材】
#在 _____上补充一行代码#不要修改其他代码import random random.seed(20)
sum=0for i inrange(10):(1)________________________ sum+=n (2)_________________________ print("10 个随机数的平均数是:{}".format(round(sum/10,1)))
【参考代码】
#在 _____上补充一行代码#不要修改其他代码import random random.seed(20)
sum=0for i inrange(10): n = random.randint(1,20)
sum+=n print('第{}个数:{}'.format(i,n))
print("10 个随机数的平均数是:{}".format(round(sum/10,1)))
第 51 套题
【题目素材】
#请在_______上填写一行表达式或语句#可以修改其他代码
defallFactor(n):
if n <=1:return[n]
if n <=3:return[1,n] i=1 _____(1)___________ while i <= n:
if n % i ==0: rlist.append(i) _____(2)___________ return rlist try: n=eval(input("请输入一个正整数:"))
print("整数{}的因子是:{}".format(n,allFactor(n)))
except:print("输入错误!")
【参考代码】
#请在_______上填写一行表达式或语句#可以修改其他代码
defallFactor(n):
if n <=1:return[n]
if n <=3:return[1,n] i=1 rlist =[]
while i <= n:
if n % i ==0: rlist.append(i) i +=1return rlist try: n=eval(input("请输入一个正整数:"))
print("整数{}的因子是:{}".format(n,allFactor(n)))
except:print("输入错误!")
第 52 套题
【题目素材】
#在____________上补充代码#不要修改其他代码 f =input("请输入一个单词:")print("{}".format("____________))
print("____________".format(f))
【参考代码】
#在____________上补充代码#不要修改其他代码 f =input("请输入一个单词:")print("{}".format("="*20))
print("|{:*^18}|".format(f))
第 53 套题
【题目素材】
#在____________上补充代码#不要修改其他代码
defvfun(x,b): ____________: x += ____________ return x lc = ____________ print(vfun(10,lc))
【参考代码】
#在____________上补充代码#不要修改其他代码
defvfun(x,b):
for i in lc: x +=eval(i)
return x lc =input().split(',')
print(vfun(10,lc))
第 54 套题
【题目素材】
#在____________上补充代码#不要修改其他代码 ss =input("请输入一个字符串:")for s in ss:
if ____________:print(____________)else: ____________
【参考代码】
#在____________上补充代码#不要修改其他代码 ss =input("请输入一个字符串:")for s in ss:
iford('A')<=ord(s)<=ord('z'):print(s.upper(),end="")
else:continue
第 55 套题
【题目素材】
#在 ____________上补充一行代码#不要修改其他代码 pi=3.14159 r = ____________ print("圆的半径是____________,面积是{____________}".format(r, pi * r * r))
【参考代码】
#在 ____________上补充一行代码#不要修改其他代码 pi=3.14159 r =eval(input("请输入圆的半径:"))print("圆的半径是{:=^10.2f},面积是{:*>10.2f}".format(r, pi * r * r))
第 56 套题
【题目素材】
#在 ____________上补充一行代码#不要修改其他代码 ls =eval(input())print("输入是:{},平均数是:{}".format(ls, ____________))
【参考代码】
#在 ____________上补充一行代码#不要修改其他代码 ls =eval(input())print("输入是:{},平均数是:{}".format(ls,sum(list(ls))/len(ls)))
第 57 套题
【题目素材】
## 在____________上补充代码# 在……上补充一行或多行代码# 可以任意修改代码# s =input("请输入字符串:")for c in s: …… else:print("全部是英文小写")
【参考代码】
## 在____________上补充代码# 在……上补充一行或多行代码# 可以任意修改代码# s =input("请输入字符串:")for c in s: zimu ="qwertyuiopasdfghjklzxcvbnm"if c in zimu:passelse:print("不全是英文小写")
breakelse:print("全部是英文小写")