PAT (Basic Level) Practice Python解法 1033 旧键盘打字(str大小写转换判断)
bad = input()
ckl = input()
if ('+' in bad):#大写打不出来
for item in ckl:
if (not item.isupper()) and (item.lower() not in bad) and (item.upper() not in bad):
print(item,end='')
else:
for item in ckl:
if (item.lower() not in bad) and (item.upper() not in bad):
print(item, end='')
这里如果用list进行读入会超时报错,减少容器使用。
这篇博客介绍了如何使用Python处理旧键盘打字问题。代码通过判断输入字符是否能在旧键盘上打出,过滤出能正常打印的字符。如果存在大写字符打不出来的情况,代码会额外检查小写形式。此问题涉及到字符串操作和条件判断,适合初学者学习。
&spm=1001.2101.3001.5002&articleId=120007077&d=1&t=3&u=93857928425d4a31929aacb563344e70)

被折叠的 条评论
为什么被折叠?



