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

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

python 3.6.6輸入不從輸入返回任何內(nèi)容

python 3.6.6輸入不從輸入返回任何內(nèi)容

元芳怎么了 2021-10-10 13:40:22
我的代碼目前非常簡單#BlackJackprint("welcome to Wasteful's blackjack game")`print("this program was built using standard python")print("please select a option")print("A to start, B to quit")print("----------------------------")menu_select = input("A/B: ").lowerif menu_select == "a":    print("starting game when i can be assed to program it")elif menu_select == "b":    exit()else:    print("invalid")但它對兩者a和b?都返回空白?我被卡住了,可以使用一些幫助,謝謝!編輯:我注意到 .lower 中的愚蠢錯誤應該是 .lower()
查看完整描述

2 回答

?
精慕HU

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

def main():

    print("welcome to Wasteful's blackjack game") 

    print("this program was built using standard python")

    print("please select a option") 

    print("A to start, B to quit")

    print("----------------------------")

    menu_select = input("A/B: ").lower()


    if (menu_select == "a"):

        print("starting game when i can be assed to program it") 


    elif (menu_select == "b"):

        exit() 


    else: 

        print("invalid")


main()

首先就像 rassar 說的,你必須在你從用戶那里得到你的輸入之后調(diào)用 .lower() 。接下來,我總是發(fā)現(xiàn)創(chuàng)建一個主循環(huán)函數(shù)來調(diào)用所有未來的函數(shù)并保持代碼漂亮整潔更容易!希望這會有所幫助!快樂編碼!:)


查看完整回答
反對 回復 2021-10-10
?
楊__羊羊

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

這是因為你不打電話lower(),你設置menu_select的函數(shù)本身:


>>> menu_select = input("? ").lower

>>> menu_select

<built-in method lower of str object at 0x10ca5eab0>

將您的線路更改為:


menu_select = input("A/B: ").lower()


查看完整回答
反對 回復 2021-10-10
  • 2 回答
  • 0 關(guān)注
  • 187 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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