Advertisement
Guest User

Untitled

a guest
Mar 28th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. tempq = []
  2. idx = 0
  3. found = False
  4. while idx < len(aList) and not found: #This section works out the index
  5. if aList[idx] == usrstr: # of the user string that needs removed
  6. found = True # from the queue list.
  7. else:
  8. idx = idx + 1
  9.  
  10. if found:
  11. for i in range(len(aList)): #This sections takes the index previously
  12. if i == idx: #found and uses it to create a new list
  13. continue #without the element the user has requested to be removed
  14. tempq.append(aList[i])
  15.  
  16. aList = tempq
  17. print(aList)
  18. return aList
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement