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

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

Python 函數(shù)不會(huì)退出或指向另一個(gè)函數(shù)

Python 函數(shù)不會(huì)退出或指向另一個(gè)函數(shù)

開滿天機(jī) 2021-12-08 14:44:50
正在做我的 Python 評(píng)估,除了不斷地展示自己之外,我無法讓我的功能做任何事情。它不會(huì)退出或轉(zhuǎn)移到下一個(gè)功能對(duì)不起,如果這有點(diǎn)傻,但我真的不知道該怎么做或如何描述問題    def main_menu():              menu_choice = input("""---------------------------------------Welcome to the GCSE Celebrity Dogs Game Please choose an option from the menu---------------------------------------1) Play the game2) Quit""")    if menu_choice == 1:     deck_choice()    elif menu_choice == 2:     print("Exiting game.....")     quit()    else:     main_menu()correct_numbers = [6,8,10,12,14,16,18,20,22,24,26,28,30]def deck_choice():    num_cards = input("""How many cards owuld you liek to play with?**Please note this must be a number between 4 and 30 and cannot be odd**""")    if num_cards not in correct_numbers:        print("Sorry, that number isnt valid. Please enter another number")    else:        return num_cardsmain_menu() 
查看完整描述

1 回答

?
開心每一天1111

TA貢獻(xiàn)1836條經(jīng)驗(yàn) 獲得超13個(gè)贊

您需要將 to 轉(zhuǎn)換為menu_choicetoint以便您可以將其與 an 進(jìn)行比較,int或者將 int 轉(zhuǎn)換為if語句中的字符串。


例如,要將輸入轉(zhuǎn)換為 int:


menu_choice = input("""your menu""")


if int(menu_choice) == 1:

    # do stuff

或者,將 int 轉(zhuǎn)換為字符串:


menu_choice = input("""your menu""")


if menu_choice == str(1):

    # do stuff


查看完整回答
反對(duì) 回復(fù) 2021-12-08
  • 1 回答
  • 0 關(guān)注
  • 227 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)