File tree Expand file tree Collapse file tree 3 files changed +43
-8
lines changed
Expand file tree Collapse file tree 3 files changed +43
-8
lines changed Original file line number Diff line number Diff line change 1414Card = collections .namedtuple ("Card" , ["rank" , "suit" ])
1515
1616# %% ../nbs/05_deck.ipynb 9
17- #| code-fold: true
17+ # | code-fold: true
1818class FrenchDeck :
1919 ranks = [n for n in range (1 , 14 )]
2020 suits = "spades diamonds clubs hearts" .split ()
Original file line number Diff line number Diff line change 1111from mydeck .core import Card
1212
1313# %% ../nbs/06_hand.ipynb 3
14- #| code-fold: true
14+ # | code-fold: true
1515class Hand :
1616 def __init__ (
17- self , max_cards : Optional [int ] = None # Max amount of cards it can be hold
17+ # Max amount of cards it can be hold
18+ self ,
19+ max_cards : Optional [int ] = None ,
1820 ):
1921 self ._max_cards = max_cards
2022 self .cards : List [Card ] = []
Original file line number Diff line number Diff line change 137137 "execution_count" : null ,
138138 "id" : " 8cabce32" ,
139139 "metadata" : {},
140- "outputs" : [],
140+ "outputs" : [
141+ {
142+ "data" : {
143+ "text/plain" : [
144+ " Card(rank=1, suit='spades')"
145+ ]
146+ },
147+ "execution_count" : null ,
148+ "metadata" : {},
149+ "output_type" : " execute_result"
150+ }
151+ ],
141152 "source" : [
142153 " #| exec_doc\n " ,
143154 " #| code-fold: false\n " ,
144155 " card = Card(rank=1, suit=\" spades\" )\n " ,
145156 " \n " ,
146- " hand.draw(card)\n " ,
157+ " hand.draw(card) # type: ignore \n " ,
147158 " hand"
148159 ]
149160 },
160171 "execution_count" : null ,
161172 "id" : " 45aa3d73" ,
162173 "metadata" : {},
163- "outputs" : [],
174+ "outputs" : [
175+ {
176+ "data" : {
177+ "text/plain" : [
178+ " [Card(rank=1, suit='spades')]"
179+ ]
180+ },
181+ "execution_count" : null ,
182+ "metadata" : {},
183+ "output_type" : " execute_result"
184+ }
185+ ],
164186 "source" : [
165187 " #| exec_doc\n " ,
166188 " [card for card in hand]"
171193 "execution_count" : null ,
172194 "id" : " 1b8584bd" ,
173195 "metadata" : {},
174- "outputs" : [],
196+ "outputs" : [
197+ {
198+ "data" : {
199+ "text/plain" : [
200+ " 0"
201+ ]
202+ },
203+ "execution_count" : null ,
204+ "metadata" : {},
205+ "output_type" : " execute_result"
206+ }
207+ ],
175208 "source" : [
176209 " #| exec_doc\n " ,
177- " hand.discard()\n " ,
210+ " hand.discard() # type: ignore \n " ,
178211 " len(hand)"
179212 ]
180213 },
You can’t perform that action at this time.
0 commit comments