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

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

Python 告訴我我的 if 語句包含語法錯誤

Python 告訴我我的 if 語句包含語法錯誤

梵蒂岡之花 2021-07-28 21:38:43
我今天正在寫一些代碼,只是一個小腳本,它最多占用三個字符串,并把它們弄亂,顛倒它們,并將它們按不同的順序排列。當我嘗試運行我的代碼時,我收到一個無效的語法錯誤,但我真的不知道為什么。ammount = int(input("How many strings would you like to input? 1, 2 or 3?")# Getting user inputif ammount == 1:    input1 = str(input("Please enter the first string"))elif ammount == 2:    user_input_1 = str(input("Please enter the first string"))    user_input_2 = str(input("Please enter the second string"))elif ammount == 3:    user_input_1 = str(input("Please enter the first string"))    user_input_2 = str(input("Please enter the second string"))    user_input_3 = str(input("Please enter the third string"))
查看完整描述

2 回答

?
翻翻過去那場雪

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

)轉(zhuǎn)換為 int 后,您錯過了關(guān)閉

ammount = int(input("How many strings would you like to input? 1, 2 or 3?"))


查看完整回答
反對 回復(fù) 2021-08-03
?
隔江千里

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

您可能在 if 語句中收到錯誤消息,因為您)if ammount ==1:語句之前的行尾缺少一個結(jié)束括號。錯誤落在 if 語句上,因為 python 解釋器認為您試圖將 if 語句放在轉(zhuǎn)換為 int 函數(shù)的內(nèi)部,而它不屬于那里


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

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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