2 回答
TA貢獻1845條經驗 獲得超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 說的,你必須在你從用戶那里得到你的輸入之后調用 .lower() 。接下來,我總是發現創建一個主循環函數來調用所有未來的函數并保持代碼漂亮整潔更容易!希望這會有所幫助!快樂編碼!:)
TA貢獻1943條經驗 獲得超7個贊
這是因為你不打電話lower(),你設置menu_select的函數本身:
>>> menu_select = input("? ").lower
?
>>> menu_select
<built-in method lower of str object at 0x10ca5eab0>
將您的線路更改為:
menu_select = input("A/B: ").lower()
添加回答
舉報
