随机生成单词混淆项
本帖最后由 tiger20100907 于 2022-7-24 10:02 编辑import random
while 1:
x=input("输入一个单词")
list1=list(x)
list2=list(x)
list3=[]
a = random.randint(2,4)
c = list1
del list1
chars = []
for i in range(97,123):
chars.append(chr(i))
for i in range(0,3):
z=0
z=random.choice(chars)
while z==c:
z=random.choice(chars)
list1.insert(random.randint(2,4),z)
list4=str(list1)
list3.insert(0,list4)
list1.remove(z)
list3.insert(0,list2)
random.shuffle(list3)
print(list3)
有创意!
页:
[1]