2 回答

TA貢獻1811條經(jīng)驗 獲得超6個贊
如果<6,你可能永遠不會從循環(huán)中走出來,所以你的程序永遠不會碰到你的循環(huán)。whilechoicefor
修復你可以做一個保存所有選項,閱讀一次和基于輸入創(chuàng)建dictinputcontestants
options = {
1: ["BeBe Zahara Benet", "Tyra Sanchez", "Raja", "Sharon Needles", "Jinkx Monsoon", "Bianca Del Rio", "Violet Chachki", "Bob the Drag Queen", "Sasha Velour", "Aquaria", "Yvie Oddly", "Chad Michaels", "Alaska", "Trixie Mattel", "Trinity the Tuck", "Monét X Change"],
2: ["Nina Flowers", "Raven", "Manila Luzon", "Chad Micheals", "Alaska", "Courtney Act", "Ginger Minj", "Kim Chi", "Peppermint", "Eureka", "Brooke Lynn Hytes", "Katya", "Kennedy Davenport", "Monique Heart"],
3: ["Akashia", "Jujubee", "Alexis Mateo", "Latrice Royale", "Coco Montrese", "Trinity K. Bonet", "Kennedy Davenport", "Chi Chi DeVayne", "Peppermint", "Kameron Michaels", "Ra'Jah O'Hara", "Raven", "Alaska", "BenDeLaCreme", "Trinity the Tuck"],
4: ["Nina Flowers", "Pandora Boxx", "Yara Sofia", "Latrice Royale", "Ivy Winters", "BenDeLaCreme", "Katya", "Cynthia Lee Fontaine", "Valentina", "Monét X Change", "Nina West"],
5: ["Victoria Parker", "Shangela", "Venus D-Lite", "Alisa Summers", "Penny Tration", "Kelly Mantle", "Tempest DuJour", "Laila McQueen", "Jaymes Mansfield", "Vanessa Vanjie Mateo", "Soju", "Mimi Imfurst", "Coco Montrese", "Thorgy Thor", "Jasmine Masters"],
6: ["Carmen Carrera", "Shangela", "Kenya Michaels", "Trixie Mattel", "Naysha Lopez", "Cynthia Lee Fontaine", "Eureka", "Vanessa Vanjie Mateo", "Alyssa Edwards", "Tatianna", "Morgan McMichaels", "Latrice Royale", "Manila Luzon"]
}
print('''Which group of queens do you want to compete against?
1. Winners
2. Runner-ups
3. Lip sync assassins
4. Miss Congenialities
5. First Eliminated
6. Returning queens''')
choice = int(input())
while choice > 6 or choice < 1:
print("Please choose one of the 6 groups")
choice = int(input())
contestants = options[choice]

TA貢獻1752條經(jīng)驗 獲得超4個贊
正如我所看到的,你添加了更多的代碼。您正在檢查您的選擇是否大于 6,然后與小于 6 的值進行比較。你從來沒有碰到過那個循環(huán)。while
無需遍歷索引。直接遍歷列表。
for x in contestants: print(x) time.sleep(0.5)
添加回答
舉報