基本上,您輸入名稱並將它們保存到列表中。假設我輸入了「a,b,c,d和e」,打印完列表後,出現「a,a,a,a」和「無法使用列表循環
然後,當它詢問學生是否支付了,這不要緊,你輸入的名字將不會被移動到指定的名單什麼價值
name_list = []
count = 0
name = raw_input("Enter the student's name: ")
while count < 5: #CHANGE BACK TO 45
name == raw_input("Enter the student's name: ")
name_list.append(name)
count = count + 1
print "List full"
print name_list
paid_list = []
unpaid_list = []
for names in name_list:
print "Has " + name + " paid? Input y or n: "
input == raw_input()
if input == "y":
paid_list.append[input]
name_list.next
elif input == "n":
unpaid_list.append[input]
name_list.next
print "The students who have paid are", paid_list
print "The students who have not paid are", unpaid_list
爲什麼迪yiy wrute'name_list.next'? –
我建議你學習Python中'='和'=='的區別 – SiHa