List of 4 items is given. I need to iteratively remove an item from the list. At each iteration I need to show: - What is removed - New list
I am trying this:
import random
teams=["Tottenham", "Ajax", "Barcelona", "Liverpool"]
for i in teams:
t1=random.randint(0, len(teams)-1)
print(teams[t1])
teams.remove(teams[t1])
print(teams)
I am getting this:
Ajax
['Tottenham', 'Barcelona', 'Liverpool']
Liverpool
['Tottenham', 'Barcelona']
But should get something like this:
Ajax
['Tottenham', 'Barcelona', 'Liverpool']
Liverpool
['Tottenham', 'Barcelona']
Tottenham
['Barcelona']