SO, im gonna make a abnormal deck of cards. Each card will have a color (red, green, blue), a degree(1,2,3), a symbol(triangle, square, circle) and a number.(1,2,3) I have a class that looks like this.
class card:
def __init__(self, color, degree, symbol, number):
self.color=color
self.degree=degree
self.symbol=symbol
self.number=number
def __repr__(self):
return "(%s,%s,%s,%s)" %(self.color,self.degree,self.symbol,self.number)
I also have these lists with all the variables and a deck of cards where i want the cards.
colors=["red", "green", "blue"]
degrees=["1","2","3"]
symbols=["triangle", "square", "circle"]
numbers=["1","2","3"]
deck=[]
Now, what i wanna do is create a full deck with every possible card. Preferably they would be in a random order but its not nessecary. I know that if it was just a number and color i could easily do it this way.
deck = [card(value, color) for value in range(0, 2) for color in colors]
But, i cant figure out how to make it when im also gonna use symbol and degree as well. I tried to just build on more if statements to loop it all but that didnt work. I also doesnt want the same card to appear twice, and i dont want a card that doesnt follow the class rules, they must be strutured as [color,degree,symbol,number]
Does anyone have a idea where to go with this?