I want a way to remove an element from the list after selecting it with the random so as not to be selected again. When i am trying to run this code:
import random
list1 = ['afgdddd', 'bcbvnbn', 'casretb', 'dbcbv ', 'egfhsgs']
list2 = ['a5y5546', 'brtewtwret', 'chrtyey', 'dqawtet', 'egreg']
choice1 = random.randint(0, len(list1) - 1)
x=(list2[choice1])
list1.remove(choice1)
list2.remove(x)
print(x)
print(list1[choice1])
print(list2[choice1])
Then I get this error: ValueError: list.remove(x): x not in list