#4 Blackjack

Blackjack, also known as 21, is a card game where players try to get as close to 21 points as possible without going over. This program uses images drawn with text characters, called ASCII art. American Standard Code for Information Interchange (ASCII) is a mapping of text characters to numeric codes that computers used before Unicode replaced it. The playing cards in this program are an example of ASCII art:

 ___   ___
|A  | |10 |
| ♣ | | ♦ |
|__A| |_10|

You can find other rules and the history of this card game at https://en.wikipedia.org/wiki/Blackjack.

The Program in Action

When you run blackjack.py, the output will look like ...

Get The Big Book of Small Python Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.