from random import randint
for i in range(5):
FN = (input("What is your name?"))
firstletter = FN[:1]
SN = []
first3letters = SN[:3]
x = str(len(SN))
sentence = str(randint(0,9))+(first3letters.lower())+(firstletter.upper()+(x))
print(sentence)
我需要創建一個數組,它將被打印出來,並由使用此代碼生成的5個用戶名組成。我會怎麼做?如何將數組添加到此?
'SN = []'和'first3letters = SN [:3]',你確定嗎? – SparkAndShine
我這麼認爲?它有錯誤嗎? @sparkandshine –
如果是這樣,'first2letters'總是等於'[]'。這是你想要的情況嗎? – SparkAndShine