Intro to
Programming
(with Python)

Fall 2018
course
site

Tue Nov 13

Discuss the homework and look at Jim's card game classes as examples.

What are you thinking of for a final project?

Please read chapter 12, "object oriented design" ... that's the topic for this week. It's essentially just more practice with using objects.

Between now and the end of the term the coding assignments will be short, in order to leave you time to work on your projects ... so do that, eh?


Consensus was that it was best to walk through a black jack object program slowly, so I wrote one during class and explained it.

It's attached. This one is simpler than my examples linked above.

$ python cards.py 
New deck: <Deck of 52 cards>
Pulled top card. It is king of spades.
The deck is now : <Deck of 51 cards>
-- adding cards to a hand --
value=0 <Hand of 0 cards: >
value=3 <Hand of 1 cards: three of spades, >
value=5 <Hand of 2 cards: three of spades, two of clubs, >
value=13 <Hand of 3 cards: three of spades, two of clubs, eight of diamonds, >
https://cs.marlboro.college /cours /fall2018 /python /notes /cards
last modified Thu November 21 2024 12:01 pm

attachments [paper clip]

  last modified size
TXT cards.py Thu Nov 21 2024 12:01 pm 2.7K