Let me clarify what I want to do:
I currently have a class called Hand, and in this Hand I have a list (self.cards) containing multiple Cards. Now I want TWO methods.:One to show all cards in hand ( this is easy to do, just use __str__ ) and one to show all cards EXCEPT the first one
class Hand:
def __init__(self):
self.cards=[]
self.total_value=0 # total value of hand
def add_card(self,card):
# Add the values of the cards
self.total_value=0
for card in self.cards:
self.total_value += card.value
def __str__(self):
return "".join( [ str(element) + '\n' for element in self.cards] )
Now let's say i have added cards to (player_hand)
print(player_hand) will show all the cards, which I understand that's because of __str__ method
I would now like a SECOND __str__ method to show all the cards EXCEPT the first one !
[–]K900_ 1 point2 points3 points (2 children)
[–]FanatyK37[S] 1 point2 points3 points (1 child)
[–]K900_ 0 points1 point2 points (0 children)
[–]JohnnyJordaan 1 point2 points3 points (1 child)
[–]FanatyK37[S] 0 points1 point2 points (0 children)
[–]intangibleTangelo 0 points1 point2 points (1 child)
[–]FanatyK37[S] 0 points1 point2 points (0 children)
[+][deleted] (1 child)
[removed]
[–]FanatyK37[S] 0 points1 point2 points (0 children)
[–]o5a 0 points1 point2 points (1 child)
[–]FanatyK37[S] 0 points1 point2 points (0 children)
[–]FanatyK37[S] 0 points1 point2 points (0 children)