第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

你如何解決這個問題,而循環(huán)?

你如何解決這個問題,而循環(huán)?

www說 2022-08-02 18:32:30
編輯:我有另一個問題,但它不會讓我再次發(fā)布代碼是這樣的:print('''Which group of queens do you want to compete against?1. Winners2. Runner-ups3. Lip sync assassins4. Miss Congenialities5. First Eliminated6. Returning queens''')choice = int(input())while choice > 6:  if choice == 1:    contestants = ["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"]  elif choice == 2:    contestants = ["Nina Flowers", "Raven", "Manila Luzon", "Chad Micheals", "Alaska", "Courtney Act", "Ginger Minj", "Kim Chi", "Peppermint", "Eureka", "Brooke Lynn Hytes", "Katya", "Kennedy Davenport", "Monique Heart"]  elif choice == 3:    contestants = ["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"]  elif choice == 4:    contestants = ["Nina Flowers", "Pandora Boxx", "Yara Sofia", "Latrice Royale", "Ivy Winters", "BenDeLaCreme", "Katya", "Cynthia Lee Fontaine", "Valentina", "Monét X Change", "Nina West"]  elif choice == 5:不起作用的部分是這樣的:else:    while choice > 6 or choice < 1:        print("Please choose one of the 6 groups")        choice = int(input())循環(huán)繼續(xù)進行,并且沒有我輸入的內(nèi)容(除非我輸入除整數(shù)以外的任何內(nèi)容,否則它將顯示錯誤消息)。當我輸入1到6之間的整數(shù)時,我如何停止此操作?
查看完整描述

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]


查看完整回答
反對 回復 2022-08-02
?
溫溫醬

TA貢獻1752條經(jīng)驗 獲得超4個贊

正如我所看到的,你添加了更多的代碼。您正在檢查您的選擇是否大于 6,然后與小于 6 的值進行比較。你從來沒有碰到過那個循環(huán)。while

無需遍歷索引。直接遍歷列表。

for x in contestants:
    print(x)
    time.sleep(0.5)


查看完整回答
反對 回復 2022-08-02
  • 2 回答
  • 0 關注
  • 112 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號