seriouosly elusive for loop (racking my brains!)
- by user1693359
I've got a loop issue in Python 2.72 that's really frustrating me. Basically the loop is not iterating fast the first index (j), and I've tried all sorts of ways to fix it with no luck.
def learn(dataSet):
for i in dataSet.getNext():
recall = raw_input("Enter all members of %s you are able to recall >>> (separated by commas) " % (i.getName()))
missed = i.getMembers()
missedString = []
for a in missed:
missedString.append(a.getName())
Here is the loop I can't get to iterate. The first for loop only goes through the first iteration of 'j' in the split string list, then removes it from 'missedString'. I would like for all members of the split-string 'recall' to be removed from 'missedString'.
for j in string.split(recall, ','):
if j in missedString:
missedString.remove(j)
continue
for b in missed:
if b.getName() not in missedString:
missed.remove(b)
print 'You missed %d. ' % (len(missed))
if (len(missed)) > 0:
print 'Maybe a hint or two will help...'
for miss in missed:
remind(miss.getSecs(), i.getName(), missed)
I really have no clue, help would be appreciated!