Creating a Simple PYTHON App – #3 – The BlackJack Case Study

Learn Blackjack Video Source & Info:

This video describes the code necessary to implement a 2 person BlackJack game in Python. I took this code from the excellent text “Intro to Computing using Python” by Perkovic (Wiley). An excellent text for anyone learning Python. This case study is only appropriate *after* someone has covered the basics of Python, which include how to use all the main data types and structures (such as dictionaries). It is intended to show the huge benefit in developing a discipline of unit testing and blackbox design *before* starting to write code. This completes the education of our app building process: learning about testing, organizing what code modules we need and how they should interface; and *finally* writing the code.

Source: YouTube

Share this video:
Creating a Simple PYTHON App – #3 – The BlackJack Case Study

4 thoughts on “Creating a Simple PYTHON App – #3 – The BlackJack Case Study

  1. cool vid! shouldn't we move the conditional portion "houseTotal == 21 and 2 == len(house) < len(player)" above? otherwise we will never know if the player or the house won with blackjack. at least in Ruby!

  2. Thank you sir for such a lucid and in depth explanation!
    I hope you get to impart knowledge to masses through this channel. All the best!

  3. Why do the keys in the dictionary only match to the first letter/number in the string? And how would you change that? Have '10':10 and 'King':10 for example.

  4. Hi Dave,
    Thank you for this video and such good explanation.

    I am writing the code exactly the same as you did but for my second unit test I am getting different results. I am using Python 3 (3.7.4) and Jupyter Notebook. I tried this code on command prompt too but similar result. Following is from Jupyter Notebook:

    import random

    def shuffleDeck():
    suits = ['u2660', 'u2661', 'u2662', 'u2663']
    ranks = ['2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K', 'A']
    deck = [ ]

    for suit in suits:
    for rank in ranks:
    deck.append(rank + suit)

    return deck

    def dealCard(deck, player):
    card = deck.pop
    return card

    # test case 2
    myDeck = shuffleDeck()
    dave = [ ]
    dealCard(myDeck, dave)

    <function list.pop(index=-1, /)>

    [<function list.pop(index=-1, /)>]

    [<built-in method pop of list object at 0x00000176E394AB88>]

Comments are closed.