我想學習python,並且我遵循關於verson 3的視頻指令並使用最新的Pycharm IDE。我的代碼中出現錯誤,我找不到,初學者程序
我的屏幕看起來像指導員的屏幕,但我可以通過盯着它看太久。他的代碼在我的崩潰時執行完美。我錯過了什麼?
錯誤消息:
line 6, in <module>
balance = float(input("OK, ", name, ". Please enter the cost of the ", item, ": "))
TypeError: input expected at most 1 arguments, got 5
程序直到第一部分到線6:
# Get information from user
print("I'll help you determine how long you will need to save.")
name = input("What is your name? ")
item = input("What is it that you are saving up for? ")
balance = float(input("OK, ", name, ". Please enter the cost of the ", item, ": "))
的pycharm版本是:
PyCharm社區版2016年1月4日生成# PC-145.1504,構建於May 25,2016 JRE:1.8.0_77-b03 x86 JVM:Java HotSpot™服務器虛擬機,由 Oracle公司
現在,我只是盲目的或者是有可能在我的版本和教師版本之間有一個小更新已經發生了一個可能的IDE的問題,他正在教蟒蛇3.
非常感謝提前任何人都可以拋出的幫助。
就像錯誤信息所說的那樣,'input'只有一個參數。因此,將大部分內容放入'print'調用中,並將'':''作爲'input'提示符。 –
您可能會在'input()'中將'''用'連接運算符'+'混淆 - 將所有''改爲'+',您應該沒問題。 – Bassem
'輸入預期最多1個參數,得到5''你傳遞5個參數,你應該傳遞1.邁克爾 – njzk2