我試圖創建一個變量,這是從列表 列表中的字符串就是字母表(不要問爲什麼,它只是爲該程序)採取某些部分從字符串,然後用它來創建一個字符串變量
passwords = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
基本上,我曾經有帶4個隨機字母從它的變量,以創建一個看起來像這樣的字符串:
correctPassword = random.sample(passwords,4)
我需要的是從4個特定字符列表創建相同類型的字符串變量,單詞「STOP」。
對此的答案將不勝感激,我試圖重新創建來自輻射的黑客小遊戲,如果你們中的任何人知道那是什麼,謝謝!
請顯示您迄今嘗試解決此問題的方法。用你的代碼解釋你面臨的問題。 – idjaw
你可以嘗試和更清楚一點嗎? – Rosh
由於信件是爲了,不能你只需要使用的S,T,O,P的指數的指數? –