2016-11-10 59 views
-1

這是代碼,我得到的錯誤:類型錯誤:unorderable類型:STR()> int()函數與清單

linb = [] 
cpt = 20 
temp = 0  
while cpt != 0: 
    linb.append(input("Plus que " + str(cpt) + " nombre a rentrer: ")) 
    cpt -= 1 
for i in linb: 
    if i > temp: 
     temp = i 
print(temp) 
print(linb.index(temp)) ' 

這ISSU是爲「爲我的鈮酸鋰:」但我可以」 t轉換我.. Linb是一個數字列表和溫度唯一的數字。

感謝您的幫助!

回答

3

input返回一個字符串(str),你必須轉換爲整數(int):

linb.append(int(input("Plus que " + str(cpt) + " nombre a rentrer: "))) 
+0

Thakns了很多! – Bloodthief

相關問題