> For the complete documentation index, see [llms.txt](https://kgisl.gitbook.io/lab3003/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kgisl.gitbook.io/lab3003/docs/deck.md).

# Deck

Represents a deck of cards.\
Attributes: cards: list of Card objects.

## Methods

### **init**

Initializes the Deck with 52 cards.

#### Parameters

| name | description | default |
| ---- | ----------- | ------- |
| self |             |         |

### **str**

Returns a string representation of the deck.

#### Parameters

| name | description | default |
| ---- | ----------- | ------- |
| self |             |         |

### add\_card

Adds a card to the deck.\
card: Card

#### Parameters

| name | description | default |
| ---- | ----------- | ------- |
| self |             |         |
| card |             |         |

### remove\_card

Removes a card from the deck or raises exception if it is not there.\
card: Card

#### Parameters

| name | description | default |
| ---- | ----------- | ------- |
| self |             |         |
| card |             |         |

### pop\_card

Removes and returns a card from the deck.\
i: index of the card to pop; by default, pops the last card.

#### Parameters

| name | description | default |
| ---- | ----------- | ------- |
| self |             |         |
| i    |             |         |

### shuffle

Shuffles the cards in this deck.

#### Parameters

| name | description | default |
| ---- | ----------- | ------- |
| self |             |         |

### sort

Sorts the cards in ascending order.

#### Parameters

| name | description | default |
| ---- | ----------- | ------- |
| self |             |         |

### move\_cards

Moves the given number of cards from the deck into the Hand.\
hand: destination Hand object num: integer number of cards to move

#### Parameters

| name | description | default |
| ---- | ----------- | ------- |
| self |             |         |
| hand |             |         |
| num  |             |         |
