SimonTheChain / deck_of_cards

A module to create and interact with a deck of cards object.
https://pypi.org/project/deck-of-cards/
5 stars 4 forks source link

Same issue about object address being returned instead of an actual value #4

Closed OakandRocks closed 2 years ago

OakandRocks commented 2 years ago

I need to use the value and run it through some other stuff, but when I try to, for example, pull a card out of the deck... well I just get an object address.

I need something like Ad or As or Ac or Ah

SimonTheChain commented 2 years ago

This is not "the same issue", it's just how the module works; please see the examples on how to interact with the card objects:

give out a random card card = deck_obj.give_random_card()

card objects have the following attributes:

card.suit # 0=spades, 1=hearts, 2=diamonds, 3=clubs, 4=joker card.rank # 1=Ace, 11=Jack, 12=Queen, 13=King, 14=B&W Joker, 15=Color Joker card.value # defaults: same as rank card.name # string representation card.image_path = "" # path to an image file corresponding to the card

So for your example, Ad or As or Ac or Ah: card.rank + card.suit will give you the info you need.