irvkalb / object-oriented-python-code Goto Github PK
View Code? Open in Web Editor NEWCode from Object-Oriented Python
License: BSD 2-Clause "Simplified" License
Code from Object-Oriented Python
License: BSD 2-Clause "Simplified" License
hi, Thank you for the wonderful python object-oriented book.
But I was a little confused when I tried to practice the code in chapter 1.
We always take cards from the top, not the bottom, Is it better to use pop(0) in code?
when the code run pop(), the pointer is always placed in the last position, The next card will always be NULL;
If i take a card from the top with pop(0), next is the top card, as described in the original book.
You do need to save the nextCardSuite to Current Card Suit, or else you game shows
Next card is: King of Spades
You got it right, it was higher
Your score is: 70
Will the next card be higher or lower than the King of Clubs? (enter h or l):
Which when you ask higher or lower you display current suit value
Hi, this is about as minor as it gets, but in case it's useful...
The comment in line 11 of HigherOrLowerProcedural.py
states that the function getCard
returns a random card. This doesn't seem to be true - it returns the first card in the list, or the "top" one.
# Pass in a deck and this function returns a random card from the deck
def getCard(deckListIn):
thisCard = deckListIn.pop() # pops one off the top of the deck and returns it
return thisCard
Thanks from a happy reader!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.