<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Jonathan Key</title>
    <description>The latest articles on DEV Community by Jonathan Key (@jonathan_key_2bcfb58189bf).</description>
    <link>https://dev.to/jonathan_key_2bcfb58189bf</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3715524%2F958e6166-cb3b-456e-99f3-a18a34d36c0c.jpg</url>
      <title>DEV Community: Jonathan Key</title>
      <link>https://dev.to/jonathan_key_2bcfb58189bf</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jonathan_key_2bcfb58189bf"/>
    <language>en</language>
    <item>
      <title>Building Blackjack for the Terminal: My First Python Project</title>
      <dc:creator>Jonathan Key</dc:creator>
      <pubDate>Sat, 17 Jan 2026 02:43:58 +0000</pubDate>
      <link>https://dev.to/jonathan_key_2bcfb58189bf/building-blackjack-for-the-terminal-my-first-python-project-1dmi</link>
      <guid>https://dev.to/jonathan_key_2bcfb58189bf/building-blackjack-for-the-terminal-my-first-python-project-1dmi</guid>
      <description>&lt;h2&gt;
  
  
  Introduction: The "Why"
&lt;/h2&gt;

&lt;p&gt;For my latest programming assignment from Codecademy, I decided to build a &lt;strong&gt;Terminal-Blackjack&lt;/strong&gt; game. I chose this project because I wanted to practice translating real-world rules (like the complex logic of an Ace being either 1 or 11) into clean, functional Python code.&lt;/p&gt;

&lt;p&gt;My goal was to create a game that felt interactive and "smart" enough to play against a dealer, all within a simple text-based interface.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Game in Action
&lt;/h2&gt;

&lt;p&gt;Here is a look at the gameplay loop, showing the deck shuffling, the deal, and the logic behind hitting and standing:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F15i7owgd2xkvd9lzl7fk.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F15i7owgd2xkvd9lzl7fk.gif" alt="Alt Text" width="1106" height="626"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Behind the Code
&lt;/h2&gt;

&lt;p&gt;This project was a great way to dive deeper into Python's core features. Here are a few technical highlights from the build:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Data Structures:&lt;/strong&gt; I used a &lt;strong&gt;Dictionary&lt;/strong&gt; to map card ranks (like 'J', 'Q', 'K') to their numeric values. This made it easy to efficiently calculate hand totals.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Shuffle:&lt;/strong&gt; To ensure every game is different, I used Python’s &lt;code&gt;random&lt;/code&gt; module. This replicates a real deck being mixed before it is dealt.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Game Logic &amp;amp; Loops:&lt;/strong&gt; The core of the game is a &lt;code&gt;while&lt;/code&gt; loop that keeps the "Hit or Stand" phase active until the player either stops or "busts" (goes over 21).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dynamic Aces:&lt;/strong&gt; One of the trickiest parts was the Ace logic. I implemented logic to check whether a hand exceeds 21 and automatically adjust an Ace's value from 11 to 1 if necessary.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3ynm3ux19ma3cpjk072p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3ynm3ux19ma3cpjk072p.png" alt=" " width="800" height="617"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Check Out the Source Code
&lt;/h2&gt;

&lt;p&gt;You can explore the full logic, including how I handled the dealer's AI and the game flow, on my GitHub:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://github.com/jonathankey13-stack/Terminal-Blackjack" rel="noopener noreferrer"&gt;View Terminal-Blackjack on GitHub&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Building this game taught me that the hardest part of coding isn't just writing syntax, it's planning for every possible user decision. Seeing the logic come together to successfully crown a winner (or bust a player!) was incredibly satisfying.&lt;/p&gt;

&lt;p&gt;I'm looking forward to adding more features, like a &lt;strong&gt;save feature&lt;/strong&gt; or a &lt;strong&gt;"shoe"&lt;/strong&gt; to support multiple decks, in the future!&lt;/p&gt;

</description>
      <category>python</category>
      <category>beginners</category>
      <category>coding</category>
      <category>terminal</category>
    </item>
  </channel>
</rss>
