python王者归来第五章部分习题答案
作者:互联网
#1.正负转换
'''
a=input("请输入一个数")
a=list(a)
if a[0]=='+':
a[0]='-'
b = [str(j) for j in a]
c = ''.join(b)
print(c)
elif a[0]=='-':
a[0]='+'
b = [str(j) for j in a]
c = ''.join(b)
print(c)
else:
print("输入错误")
'''
#2.字符转换
‘’’
a=input("请输入字符")
b=a.upper()
c=a.lower()
c1=list(c)
b1=list(b)
for itemb in c1:
mac= itemb
for itema in b1:
if mac == itema[0]:
itema[1] += cnt
break
else:
b1.append(itemb)
print(b1)
‘’’
标签:王者,python,list,itemb,b1,print,input,习题,itema 来源: https://blog.csdn.net/m0_57057282/article/details/121342598