ฉันมีปัญหาในการแยกออกจากรายการขยายโดยใช้อินพุตของผู้ใช้ ฉันคิดว่าฉันขาดวิธีใช้คำสั่ง 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