有人能幫我在 Python 程式中修復該問題嗎?


粗體部分中出現的第一個問題是由於非縮排塊,將一個縮排放在那裡。

第二個問題是沒有定義名為變數。

以下是更正後的內容 -

print ("Come-on in. Need help with any bags?")
bag=input ('(1) Yes please  (2) Nah, thanks   (3) Ill get em later  TYPE THE NUMBER ONLY')
if bag == ('1'):
print ("Ok, ill be right there!")
if bag == ('2'):
print ("Okee, see ya inside. Heh, how rude of me? I'm Daniel by the way, ya?")
name="Daniel"
print (name + ": Um, Names " + name)
print ("Dan: K, nice too meet ya " + name)
if bag == ('3'):
print ("Heh, Ya remind me of someone I know... *cough* me *cough*")
print ("Oh... Nearly forgot. Names Daniel, Ya?")
print (name + ": Eh... " + name)
print ("Dan: Cool, I now a" + name)

更新日期:2020 年 6 月 24 日

70 次瀏覽

開啟你的 職業生涯

完成課程即可獲得認證

開始
廣告
© . All rights reserved.