我無法通過用戶輸入展開我的擴展列表。我想我錯過了如何使用if
語句來查詢特定項目的列表。當用戶輸入-999時,我需要打開列表來詢問輸入。我還需要從列表中排除-999。你可以幫我嗎?突破列表中的用戶輸入
print(scoreLst)
就是這樣可以測試,看看它是如何工作,因爲我使用它。
scoreLst =[]
score =()
lst1 = True
print("The list ends when user inputs -999")
scoreLst.append(input("Enter the test score: "))
while lst1 == True:
score1 = scoreLst.append(input("Enter another test score: "))
print(scoreLst)
if score1 != -999:
lst1 == True
else:
scoreLst.remove(-999)
lst1 == False
追加驗證之前沒有進入榜單 – vks