赞
踩
持续更新,新手代码勿喷.
n = int(input("请输入一个整数:"))
num = int(n*(n+1)/2)
j = 0
for i in range(65, 65+num):
j += 1
print(chr(i), end=" ")
if j == n:
print()
n -= 1
j = 0
m = str(input("输入m:")) n = str(input("输入n:")) n.lower() def judge(m, n): flag = m.isalpha() if not flag: return "ERROR" else: m.lower() for i in m: if n.find(i) == -1: return "NOT FOUND" return "FOUND" print(judge(m, n))
ID = str(input("请输入你的身份证号码:")) List1 = [0]*18 List2 = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2] Dict = {0: '1', 1: '0', 2: 'X', 3: '9', 4: '8', 5: '7', 6: '6', 7: '5', 8: '4', 9: '3', 10: '2'} def IsID(ID): for i in range(17): List1[i] = int(ID[i]) * List2[i] sum = 0 for i in List1: sum += int(i) print(sum) print(sum%11) print(Dict.get(sum % 11)) print(ID[17]) if Dict.get(sum%11) == ID[17]: return "身份证号码检验为合法号码" else: return "身份证号码检验位错误" print(IsID(ID)) # 220221197302296536
s = str(input("输入个人信息:"))
new_s = s.split(" ")
for i in range(1, len(new_s)):
if i == 1:
print("姓名: {}".format(new_s[i]))
elif i == 2:
print("班级: {}".format(new_s[i]))
elif i == 4:
temp = str(new_s[4])
temp = 2020 - int(temp[:4])
print("年龄: {}岁".format(temp))
n = int(input("输入n:")) s = "" new_s = [None]*n temp = '' for i in range(n): s = str(input("输入第{}位同学信息:".format(i+1))) new_s[i] = s.split(" ") for i in range(len(new_s)): for j in range(3): if j == 0: temp = str(new_s[i][j]) temp = temp[:4] + "*******" + temp[11:] elif j == 1: temp = str(new_s[i][j]) temp = temp[:1] + "*" + temp[2:] else: temp = str(new_s[i][j]) temp = temp[:3] + "****" + temp[7:] new_s[i][j] = temp print(new_s)
freqDict = eval(input("输入单词词频字典:"))
s = str(input("输入一段英文:"))
new_s = s.split(" ")
for i in new_s:
if i in freqDict:
freqDict[i] += 1
else:
freqDict[i] = 1
print(freqDict)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。