Type "help", "copyright", "credits" or "license" for more information. >>> from poker import * >>> dir(poker) Traceback (most recent call last): File "", line 1, in ? NameError: name 'poker' is not defined >>> JimsExample = 'Hi there' >>> dir() ['JimsExample', 'PokerCard', 'PokerDeck', 'PokerHand', '__builtins__', '__doc__', '__name__', 'randint', 'rank_names', 'ranks', 'run_tests', 'suit_names', 'suits'] >>> p = PokerCard() >>> p >>> id(p) 649536 >>> 0x9e940 649536 >>> help(int) >>> int(10, 16) Traceback (most recent call last): File "", line 1, in ? TypeError: int() can't convert non-string with explicit base >>> int('10', 16) 16 >>> '%x' % 10 'a' >>> ' The number is %i ' % 10 ' The number is 10 ' >>> dir() ['JimsExample', 'PokerCard', 'PokerDeck', 'PokerHand', '__builtins__', '__doc__', '__name__', 'p', 'randint', 'rank_names', 'ranks', 'run_tests', 'suit_names', 'suits'] >>> p >>> dir(p) ['__cmp__', '__doc__', '__init__', '__module__', '__str__', 'getRank', 'getSuit', 'rank', 'suit'] >>> print p Five of Clubs >>> p.__str__() 'Five of Clubs' >>> str(p) 'Five of Clubs' >>> p2 = PokerCard() >>> str(p2) 'Two of Spades' >>> p > p2 False >>> cmp(p, p2) -1 >>> wrong = PokerCard(suit='x', rank='12345') Traceback (most recent call last): File "", line 1, in ? File "poker.py", line 82, in __init__ raise Exception("illegal card rank '"+str(rank)+"'") Exception: illegal card rank '12345' >>> still_wring = PokerCard( suit='x', rank=7 ) Traceback (most recent call last): File "", line 1, in ? File "poker.py", line 84, in __init__ raise Exception("illegal suit '"+str(suit)+"'") Exception: illegal suit 'x' >>> d = PokerDeck() >>> len(d) 52 >>> dir() ['JimsExample', 'PokerCard', 'PokerDeck', 'PokerHand', '__builtins__', '__doc__', '__name__', 'd', 'p', 'p2', 'randint', 'rank_names', 'ranks', 'run_tests', 'suit_names', 'suits'] >>> dir(d) ['__doc__', '__init__', '__len__', '__module__', 'cards', 'deal_a_card', 'deal_n_cards'] >>> cards = d.deal_n_cards(5) >>> cards [, , , , ] >>> print cards [, , , , ] >>> len(d) 47 >>> a = PokerHand() >>> b = PokerHand() >>> print a King High : King of Spades, Eight of Clubs, Six of Spades, Four of Diamonds, Three of Hearts >>> print b Pair of Aces : Ace of Spades, Ace of Hearts, Queen of Hearts, Eight of Clubs, Six of Hearts >>> b > a True >>> d >>> c = PokerHand(deck=d) >>> len(d) 42 >>> print c Ace High : Ace of Hearts, Jack of Diamonds, Six of Diamonds, Four of Hearts, Three of Spades >>> ^D mdhcp5-79:~/Desktop mahoney$