mardi 27 juillet 2021

How to pop duplications only once from a list by comparing to another list in Python 3

I'm trying to write a card game where the cards are assigned numerical values.

a = [1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3]
b = [1, 2] 

How do I remove b (cards you draw from a deck) from a to get:

c = [1, 1, 1, 2, 2, 2, 3, 3, 3, 3]

Or... How do I take a random sample away from a to make a separate list b?




Aucun commentaire:

Enregistrer un commentaire