我创建了一个包含 45 个名字的列表。现在我想创建一个循环,在函数中单独调用每个名称(“名称 1 已付款?如果是,则下一个名称,如果否,则从列表中删除名称,然后是下一个名称”)我是 python 的新手:/我如果您给我举例而不是简单地回答问题,我将不胜感激。 谢谢
#Task 2
name_list = []
count = 0
name = "empty"
while count < 45:
name == raw_input("Enter the student's name")
name_list.append(name)
count = count + 1
print "List full"
# Where do I go from here?
请您参考如下方法:
for student in name_list:
if(input("Have the student " + student + " paid?") != "yes"):
name_list.remove[student]
