Hi!
When I print the six card I would like the "player" to be able to pick three out of these cards. Does anyone know how to do this?
Do I create a new list and then append the cards to that list?
Very thankful for any help!
Here's the first bit of code
import random
class Kortlek():
def __init__(self,colors=[], forms=[], numbers=[], grades=[]):
self.cardList = []
for color in colors:
for form in forms:
for number in numbers:
for grade in grades:
self.cardList.append(Kort(color, form, number, grade))
def spelkorten(self):
for a in random.sample(self.cardList, 6):
a.visa()
class Kort():
def __init__(self,color,form,number,grade):
self.color = color
self.form = form
self.number = number
self.grade = grade
def visa(self):
print self.color , "\t", self.form, " \t" ,self.number,"\t", self.grade
def kortutdelning():
kort = Kortlek(["blue", "yellow", "red"],["triangel", "circle", "square"],[1, 2, 3],[1, 2, 3])
kort.spelkorten()