我想創建2個數組。名稱的數組(空)和點(空)的表。函數中的兩個數組
我的問題是在我的情況。我想點必須遜色於20
這裏是我的代碼:
def demande(nb):
tabNom = []
tabCote = []
for i in range(nb):
tabNom.append(input("Entrer le " + str(i+1) + " nom svp : "))
tabCote.append(input("Entrer le " + str(i+1) + " cote svp : "))
if tabCote > 20:
print(input("Ressayez svp : "))
return tabNom, tabCote
nom, cote = demande(3)
print(nom, cote)
你有一個想法?請 謝謝很多
你的意思是,在陣列中的值應低於20? – mvrma
你在IF中怎麼做?檢查tabCote的長度是否小於20? ---->如果len(tabCote)> 20:???或者列表中的每個項目應小於20?因爲你說:「我想要的分數必須低於20分。」 – Wonka