用户:钰米是安琪拉酱酱查看:5 回复:3 评论:5 创建时间:2020-06-06T13:59:02
【作品展示】

【作品介绍】
咳咳咳众所周知
摩斯密码是二战是用于传递信息的一种加密传输的方式
在运行框内
输入要传输的英文
就能得到对应的摩斯密码啦
2020.6.6
——钰米是安琪拉酱酱
【作品源代码】
code=['.-','-..','-.-.','-..','.''..-.','--.','....','..','.---','-.-','.-..','--','-.','---','.--.','--.-','.-.','...','-','..--','...-','.--','-..-','-.--','--..']
output=""
message=input("请输入英文:")
message=message.upper()
for letter in message:
value=ord(letter)-ord('A')
if value>=0 and value<26:
output=output+code[value]+''
else:
output=output+''
print("对应的摩斯密码是",output)
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn
蒟蒻OIer1048576code=['.-','-..','-.-.','-..','.''..-.','--.','....','..','.---','-.-','.-..','--','-.','---','.--.','--.-','.-.','...','-','..--','...-','.--','-..-','-.--','--..']
message=input("请输入英文:")
output=message.lower()
for index,letter in enumerate(list("abcdefghijklnmopqrstuvwxyz")):
output = output.replace(letter,code[index])
点赞1
评论