Commit 33b3b334 by BellCodeEditor

auto save

parent 027d3568
Showing with 33 additions and 0 deletions
import random
message = "诺依,周末一起去看动漫展吧!"
key = input('请输入加密语句:')
#干扰字符
key_mes = input('请输出干扰字符:')
text = ''
for i in message:
str1 = random.choice(key)
str2 = random.choice(key)
text = text + i + str1 + str2
#字符串转成列表
text1 = list(text)
a = random.randint(0,len(text1)-1)
text1.insert(a,key_mes)
#列表转成字符串
str = ''.join(text1)
print(str)
'''
# 请对message进行遍历,取出所有元素
for i in message:
print(i)
#通过索引取
i = 0
while i <= len(message)-1:
print(message[i])
i+=1
'''
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment