-2
我目前正在做一個文本遊戲,但我的遊戲的一部分將無法正常工作,我不明白爲什麼。這是編碼:糟糕的一元操作數顯然
c1pp1 = ["Joe", "Frank", "Annie"]
while cp_ptt < 3:
s= input()
#FIX THIS!!
c1pp = input(n/ + ": Who should I talk to first?\nYour options are:\n" +\
c1pp1[0] + ", an ex-policeman\n" + c1pp1[1] + ", a carpenter\n" +\
c1pp1[2] + ", an architect\n")
我得到的結果是:
Traceback (most recent call last):
File "N:\MyWork\Year 9\Other\Random\Making a text game out of song lyrics\No.1;
Phantom Thief F's Scenario ~Mystery of the Missing Diamond~.py", line 103,
in <module>
c1pp = input(n/ + ": Who should I talk to first?\nYour options are:\n" + c1pp1[0] + ", an ex-policeman\n" + c1pp1[1] + ", a carpenter\n" + c1pp1[2] + ", an architect\n")
TypeError: bad operand type for unary +: 'str'
是否有人可以告訴我什麼是錯我的代碼?
這是'n /'一個錯字嗎?這顯然是這樣的問題。你想用這個做什麼? –
@CarlesMitjans錯誤將會是'NameError:name'n'未定義'。 – DyZ
問題是:爲什麼那裏有'n'?這是一個變量還是您嘗試打印換行符? –