2021-05-08

aList=eval(input())
Len=len(aList)
Num=int(Len/3)
Sum=0
for i in range(0,Num):
I=i*3+2
Age=int(aList[I])
Sum +=Age
Ave=Sum/Num
print(“The average age of {:.0f} students is {:.1f}”.format(Num,Ave))

2、
nList=eval(input())
Num=int(input())
x=int(input())
if Num in nList:
i=nList.index(Num)
nList.insert(i+1,x)
else:
nList.append(x)
print(nList)

3、
nList=map(int,input().split(" "))
nList=list(nList)
i=int(input())
del nList[i]
nList=list(sorted(nList,reverse=True))
print(nList)

4、
nList= map(int,input().split(" “))
nList=list(sorted(list(nList)))
Len=len(nList)
if Len%2==0:
M1=nList[int(Len/2-1)]
M2=nList[int(Len/2)]
Med=(M1+M2)/2
else:
Med=nList[int(Len//2)]
print(”{:.1f}".format(Med))

Str=input()
Str=Str.lower()
for ch in ‘,.’:
Str=Str.replace(ch," ")
Awords=Str.split()
Uwords={}
Uwords=Uwords.fromkeys(Awords)
Uwords=list(Uwords.keys())
Len=int(len(Uwords))
print(“There are {} words in the paragraph.”.format(Len))

Dict={“Jone”:“abc”,“Mike”:“123”,“Marry”:“123456”,“Rose”:“abc123”,“Tom”:“123456”}
user,password=map(str,input().split(" "))
if user not in Dict:
print(“The user does not exist”)
elif Dict[user]==password:
print(“Successful login”)
else:
print(“The password is incorrect”)

Dict={“Jone”:“abc”,“Mike”:“123”,“Marry”:“123456”,“Rose”:“abc123”,“Tom”:“123456”}
user,password=map(str,input().split(" "))
if user not in Dict:
print(“The user does not exist”)
elif Dict[user]==password:
print(“Successful login”)
else:
print(“The password is incorrect”)

a=dict(eval(input()))
b=dict(eval(input()))
for i in b:
if i not in a:
a[i]=b[i]
else:
a[i]+=b[i]
print(’{’,end=’’)
s1=[i for i in a.keys() if type(i)==type(1)]
s2=[i for i in a.keys() if type(i)==type(‘a’)]
s1.sort()
s2.sort()
c=0
n=len(a)
for i in s1+s2:
c+=1
if type(i)==type(1):
print(’{}:{}’.format(i,a[i]),end=’’)
else:
print("’{}’:{}".format(i,a[i]),end=’’)
if c!=n:
print(’,’,end=’’)
print(’}’)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值