Nov-22-2020, 07:57 PM
My problem is that I want to use del in a for loop to delete everything in a list.
Code:
I am a beginner and learning. Please explain why this is happening. Thank you
Code:
users = ['a', 'b', 'c', 'd', 'e'] for user in users: del users[0] print(users)However, this deletes everything except the last 2 values.
I am a beginner and learning. Please explain why this is happening. Thank you