嘿,我对python很陌生,而且我已经陷入困境,我基本上试图让它循环,它只会卡在一个组合上。
import random
letters = ['jaysasdfr','kileasrs','mdaawe','theuser','super','mrt','charman','allchar','ne ver','swssdord','xmasfan']
numbers = ['111','123','122','143','422','239','213','124','234''093','425','684','858','421','095','555','554','888']
extras = ['!','@','$','*','^','%','&','?','/','.','>','<']
x = random.choice(letters)
y = random.choice(numbers)
z = random.choice(extras)
t = x + y + z
while 1 == 1:
print(t)
我是朝着正确的方向前进还是完全离开?
答案 0 :(得分:0)
您的问题是您需要在while
循环中重做随机化。在您的版本中,x
,y
和z
已设置,但永远不会更改,因为您的循环只包含print
语句。
import random
letters = ['jaysasdfr','kileasrs','mdaawe','theuser','super','mrt','charman','allchar','ne ver','swssdord','xmasfan']
numbers = ['111','123','122','143','422','239','213','124','234''093','425','684','858','421','095','555','554','888']
extras = ['!','@','$','*','^','%','&','?','/','.','>','<']
while True:
x = random.choice(letters)
y = random.choice(numbers)
z = random.choice(extras)
t = x + y + z
print(t)