Open study

is now brainly

With Brainly you can:

  • Get homework help from millions of students and moderators
  • Learn how to solve problems with step-by-step explanations
  • Share your knowledge and earn points by helping other students
  • Learn anywhere, anytime with the Brainly app!

A community for students.

OldMaidGame : Why am I unable to add a card to a hand?

I got my questions answered at in under 10 minutes. Go to now for free help!
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Get this expert

answer on brainly


Get your free account and access expert answers to this and thousands of other questions

Program file attached.
1 Attachment
Print the value of card in the method to make sure that it's what you expect.
I am not sure I understood. I am printing the value of the card, and it is the top card in the deck, but the addCard method is giving an error.

Not the answer you are looking for?

Search for more explanations.

Ask your own question

Other answers:

The addCard method isn't giving you an error. I tried running the code you attached, the exception says: Traceback (most recent call last): File "C:/Users/joshua/Documents/MIT/", line 182, in["Allen","Jeff","Chris"]) File "C:/Users/joshua/Documents/MIT/", line 144, in play[names],51) File "C:/Users/joshua/Documents/MIT/", line 63, in deal hand.addCard(card) AttributeError: 'list' object has no attribute 'addCard' Note the last line where it says that 'list' object has no attribute addCard? That tells us that hand is a list and not a Hand or Deck object. In the lines above this we see that this happened in the method. You can see the actual call here: File "C:/Users/joshua/Documents/MIT/", line 144, in play[names],51) Note that you are wrapping the list of names you passed in within a list. Then that list is being passed into the function. I'm pretty sure you meant to pass in self.hands. Moreover, you are going to need to call the method to remove cards rather then operating on cards itself when you run into the next error.
Thanks. Could you attach your file, so that I can follow it better?
Here's my new program, and it still does not add cards to the hands. The remove card from deck works though.

Not the answer you are looking for?

Search for more explanations.

Ask your own question