<?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: Tehreem Fatima</title>
    <description>The latest articles on DEV Community by Tehreem Fatima (@tehreemfatimadev).</description>
    <link>https://dev.to/tehreemfatimadev</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4106128%2F52db792f-a02f-474d-bae2-ed1e3acae3db.png</url>
      <title>DEV Community: Tehreem Fatima</title>
      <link>https://dev.to/tehreemfatimadev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/tehreemfatimadev"/>
    <language>en</language>
    <item>
      <title>Building the Higher or Lower Game: A Fun Way to Practice Python Fundamentals</title>
      <dc:creator>Tehreem Fatima</dc:creator>
      <pubDate>Sat, 12 Sep 2026 09:37:23 +0000</pubDate>
      <link>https://dev.to/tehreemfatimadev/building-the-higher-or-lower-game-a-fun-way-to-practice-python-fundamentals-31p7</link>
      <guid>https://dev.to/tehreemfatimadev/building-the-higher-or-lower-game-a-fun-way-to-practice-python-fundamentals-31p7</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;I'm on Day 14 of Dr. Angela Yu's "100 Days of Code" course, and today I built something that was actually fun to play with while learning Python concepts. The game is simple: compare Instagram followers between two celebrities and guess who has more. It sounds easy, but building it taught me valuable lessons about data structures, game logic, and user experience.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;GitHub Repo:&lt;/strong&gt; &lt;a href="https://github.com/tehreem-fatima-dev/Higher_Lower_Game" rel="noopener noreferrer"&gt;Higher or Lower Game&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;A command-line game where:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The computer randomly picks two celebrities/brands/athletes&lt;/li&gt;
&lt;li&gt;You see their name, profession, and country&lt;/li&gt;
&lt;li&gt;You guess who has more Instagram followers (A or B)&lt;/li&gt;
&lt;li&gt;You keep playing and building your score until you guess wrong&lt;/li&gt;
&lt;li&gt;One wrong guess ends the game&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Simple concept. But the code behind it? That's where the learning happens.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Data Structure Challenge
&lt;/h2&gt;

&lt;p&gt;This project introduced me to a &lt;strong&gt;data structure I hadn't really used deeply before&lt;/strong&gt;: a list of dictionaries.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;name&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Cristiano Ronaldo&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;follower_count&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;215&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;description&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Footballer&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;country&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Portugal&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="c1"&gt;# ... 50+ more profiles
&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is different from my previous projects. In my student management system, I used a dictionary with student names as keys. Here, I'm working with a &lt;strong&gt;list of dictionaries&lt;/strong&gt;—each entry is independent, and I randomly pick from the list.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The difference matters:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Dictionary with keys: Great for lookups by name&lt;/li&gt;
&lt;li&gt;List of dictionaries: Better for iterating, random selection, collections of similar data&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is a subtle but important distinction that will come up a lot in real-world programming.&lt;/p&gt;




&lt;h2&gt;
  
  
  Game Logic: The Interesting Part
&lt;/h2&gt;

&lt;p&gt;The core logic has three steps:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Format and Display&lt;/strong&gt;&lt;br&gt;
I created a &lt;code&gt;format_participant()&lt;/code&gt; function to display each profile consistently:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;name&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;, a &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;description&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;, from &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;country&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Clean, reusable, easy to read.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2: Compare Followers&lt;/strong&gt;&lt;br&gt;
The &lt;code&gt;follower_count()&lt;/code&gt; function compares two participants and returns who has more followers:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;participant1&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;follower_count&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;participant2&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;follower_count&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;participant1&lt;/span&gt;
&lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;participant2&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Simple comparison logic, but it's the heart of the game.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3: Check User's Guess&lt;/strong&gt;&lt;br&gt;
The &lt;code&gt;compare()&lt;/code&gt; function maps the user's input (A or B) to the actual participant objects:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;guess&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;A&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;user_choice&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;participant1&lt;/span&gt;
&lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;user_choice&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;participant2&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then I compare if the user chose correctly.&lt;/p&gt;




&lt;h2&gt;
  
  
  What Made This Different from My Previous Projects
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Before:&lt;/strong&gt; I built management systems (student tracker, book store, pharmacy inventory)&lt;br&gt;&lt;br&gt;
&lt;strong&gt;This:&lt;/strong&gt; I built a game&lt;/p&gt;

&lt;p&gt;Management systems are CRUD (Create, Read, Update, Delete). They follow a predictable pattern. Games require different thinking:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Win/lose conditions&lt;/li&gt;
&lt;li&gt;Score tracking&lt;/li&gt;
&lt;li&gt;Continuous flow until failure&lt;/li&gt;
&lt;li&gt;User engagement and fun&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This project made me think about &lt;strong&gt;user experience&lt;/strong&gt;, not just functionality.&lt;/p&gt;




&lt;h2&gt;
  
  
  What I Learned
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Random Selection and Game Flow
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;participant2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;random&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;choice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="n"&gt;participant2&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;participant1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;participant2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;random&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;choice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I had to ensure the two participants are always different. This is a common pattern: keep trying until you get a valid result.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Breaking Logic Into Functions
&lt;/h3&gt;

&lt;p&gt;Instead of one massive game loop, I separated concerns:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Formatting display&lt;/li&gt;
&lt;li&gt;Comparing values&lt;/li&gt;
&lt;li&gt;Mapping user input&lt;/li&gt;
&lt;li&gt;Running the game&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each function does ONE thing. When something goes wrong, I know exactly where to look.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Input Validation Without Crashing
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="n"&gt;guess&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;A&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;guess&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;B&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;guess&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;input&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;You type incorrect value. Type &lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;A&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt; or &lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;B&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;: &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;strip&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;title&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This loop ensures the user enters valid input before proceeding. No crashes, just re-asking.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Screen Management
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;25&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# Clear screen
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Small detail, but it makes the game feel polished. After each round, the screen clears so it doesn't get cluttered.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Difference Between Theory and Practice
&lt;/h2&gt;

&lt;p&gt;When I first learned about functions, it seemed abstract. "Why break code into functions?"&lt;/p&gt;

&lt;p&gt;Building this game, I felt the difference:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If the display format changes, I update ONE function (&lt;code&gt;format_participant()&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;If the comparison logic needs to change, I update ONE function (&lt;code&gt;follower_count()&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;If I want to add a new feature, I know where to add it&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;This is why professional developers structure code this way.&lt;/strong&gt; It's not just about looking good—it's about maintainability.&lt;/p&gt;




&lt;h2&gt;
  
  
  What Surprised Me
&lt;/h2&gt;

&lt;p&gt;I thought building a game would be harder. But because I:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Separated concerns into functions&lt;/li&gt;
&lt;li&gt;Validated input properly&lt;/li&gt;
&lt;li&gt;Thought about the flow before coding&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;...it came together quickly and worked on the first try.&lt;/p&gt;

&lt;p&gt;The surprise wasn't that it was easy. The surprise was that &lt;strong&gt;good planning makes coding easy&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Next Steps
&lt;/h2&gt;

&lt;p&gt;This game works, but here's what I could add:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Save high scores to a file&lt;/li&gt;
&lt;li&gt;Add difficulty levels&lt;/li&gt;
&lt;li&gt;Track statistics (correct answers, most guessed celebrity)&lt;/li&gt;
&lt;li&gt;Implement a leaderboard&lt;/li&gt;
&lt;li&gt;Add more celebrities&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But for now, I'm happy with v1.0.0.&lt;/p&gt;




&lt;h2&gt;
  
  
  What This Taught Me About Learning
&lt;/h2&gt;

&lt;p&gt;I'm 14 days into a 100-day journey. I've built 10+ projects. I'm not a professional—I'm still a beginner.&lt;/p&gt;

&lt;p&gt;But I'm noticing something: &lt;strong&gt;the more I build, the faster I learn.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When I started, writing functions felt tedious. Now, I naturally break problems into functions before I start coding.&lt;/p&gt;

&lt;p&gt;When I started, validation seemed annoying. Now, I automatically add it.&lt;/p&gt;

&lt;p&gt;This is how learning works. Not through tutorials, but through &lt;strong&gt;building things and seeing patterns emerge&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Challenge to Other Learners
&lt;/h2&gt;

&lt;p&gt;If you're learning to code:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Don't just watch tutorials&lt;/li&gt;
&lt;li&gt;Build projects that interest YOU&lt;/li&gt;
&lt;li&gt;Don't aim for perfection—aim for "working"&lt;/li&gt;
&lt;li&gt;Break your code into functions&lt;/li&gt;
&lt;li&gt;Think about the user experience, not just the code&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I built this game because I thought it would be fun. And it was. That engagement matters more than any tutorial.&lt;/p&gt;




&lt;h2&gt;
  
  
  Let's Connect
&lt;/h2&gt;

&lt;p&gt;If you're also learning to code, I'd love to hear about your journey. What projects are you building? What surprised you most about learning to code?&lt;/p&gt;

&lt;p&gt;Drop a comment below!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Project Links:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/tehreem-fatima-dev/Higher_Lower_Game" rel="noopener noreferrer"&gt;GitHub Repo: Higher or Lower Game&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.udemy.com/course/100-days-of-code/" rel="noopener noreferrer"&gt;100 Days of Code by Dr. Angela Yu&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;strong&gt;Author:&lt;/strong&gt; Tehreem Fatima&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Learning Journey:&lt;/strong&gt; Day 14 of 100 Days of Code&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Current Focus:&lt;/strong&gt; Python Fundamentals &amp;amp; Project-Based Learning&lt;/p&gt;

</description>
      <category>programming</category>
      <category>python</category>
      <category>gamedev</category>
      <category>learning</category>
    </item>
    <item>
      <title>My Python Learning Journey: Refactoring My Hangman Game from v1.0 to v2.0</title>
      <dc:creator>Tehreem Fatima</dc:creator>
      <pubDate>Wed, 02 Sep 2026 12:14:29 +0000</pubDate>
      <link>https://dev.to/tehreemfatimadev/my-python-learning-journey-refactoring-my-hangman-game-from-v10-to-v20-4kg0</link>
      <guid>https://dev.to/tehreemfatimadev/my-python-learning-journey-refactoring-my-hangman-game-from-v10-to-v20-4kg0</guid>
      <description>&lt;p&gt;This is the first post in my Python learning journey, where I document what I'm learning, what I'm building, the mistakes I make, and how my code improves over time.&lt;/p&gt;

&lt;h2&gt;
  
  
  A Little About Me
&lt;/h2&gt;

&lt;p&gt;I'm currently studying Biomedical Engineering Technology, and I've been learning Python alongside my studies because I want to develop strong programming skills and build practical projects during my degree.&lt;/p&gt;

&lt;p&gt;I'm still a beginner. I haven't been programming for years, and I'm not trying to present myself as an experienced developer. My goal is much simpler:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Learn → Build → Make mistakes → Improve → Repeat.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Instead of only completing tutorials, I've been trying to build small projects to actually apply what I learn. So far, I've worked with variables, conditionals, loops, lists, strings, dictionaries, functions, randomization, and sets.&lt;/p&gt;

&lt;p&gt;One of my first real projects was a simple Hangman game. And then I decided to refactor it.&lt;/p&gt;




&lt;h2&gt;
  
  
  My Hangman Game — v1.0
&lt;/h2&gt;

&lt;p&gt;My first version was written mostly as one continuous program.&lt;/p&gt;

&lt;p&gt;It worked. I could:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Randomly select a word&lt;/li&gt;
&lt;li&gt;Display blanks for the letters&lt;/li&gt;
&lt;li&gt;Allow the player to guess letters&lt;/li&gt;
&lt;li&gt;Track lives&lt;/li&gt;
&lt;li&gt;Display Hangman stages&lt;/li&gt;
&lt;li&gt;Reveal correctly guessed letters&lt;/li&gt;
&lt;li&gt;Determine whether the player won or lost&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;At this stage, my main focus was simply getting the program to work. And honestly, that's an important stage when you're learning. I wasn't thinking deeply about software architecture. I was thinking:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;"Can I make this work?"&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The answer was yes. But once I looked at the program again, I started noticing something: the code was becoming difficult to manage.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Problem With My First Version
&lt;/h2&gt;

&lt;p&gt;As I added more functionality, the program became longer and harder to reason about. Different responsibilities were mixed together:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Choosing a word&lt;/li&gt;
&lt;li&gt;Getting user input&lt;/li&gt;
&lt;li&gt;Validating input&lt;/li&gt;
&lt;li&gt;Updating the hidden word&lt;/li&gt;
&lt;li&gt;Tracking lives&lt;/li&gt;
&lt;li&gt;Checking whether the player won&lt;/li&gt;
&lt;li&gt;Displaying messages&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Everything was happening in the main game loop. This worked for a small project, but I started asking myself:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;"What if I want to change one particular part of the game?"&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;For example, what if I wanted to improve input validation? I would have to dig through the larger program to find that logic.&lt;/p&gt;

&lt;p&gt;That's when I realized: &lt;strong&gt;making a program work and structuring a program well are two different things.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;So I decided to refactor it.&lt;/p&gt;




&lt;h2&gt;
  
  
  Refactoring Hangman — v2.0
&lt;/h2&gt;

&lt;p&gt;For version 2.0, my main goal was to break the program into smaller functions.&lt;/p&gt;

&lt;p&gt;Instead of one large block of code responsible for everything, I separated different responsibilities:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;generating_word&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;words_list&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="c1"&gt;# Selects a random word
&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;generating_blanks&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;choosen_word&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="c1"&gt;# Creates blank display
&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;getting_input&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="c1"&gt;# Gets player input
&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;input_validation&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;guess_letter&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="c1"&gt;# Validates input
&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;replacing_blanks&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;word&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;choosen_word&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;guess_letter&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="c1"&gt;# Updates word with correct guesses
&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;game_win_lose&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;choosen_word&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;word&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;remaining_lives&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;guess_letter&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="c1"&gt;# Checks win/lose conditions
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This made the structure much easier to understand. Instead of one large program, I could look at individual pieces and understand what each one was supposed to do.&lt;/p&gt;

&lt;h3&gt;
  
  
  Adding Input Validation
&lt;/h3&gt;

&lt;p&gt;Previously, the program could receive input like "hello" when it should only accept a single letter. So I added validation to ensure:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Exactly one character&lt;/li&gt;
&lt;li&gt;An alphabetic character&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This was a small addition, but it taught me something important: &lt;strong&gt;user input cannot always be trusted to be valid.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Preventing Duplicate Guesses
&lt;/h3&gt;

&lt;p&gt;I added tracking for previously guessed letters using a Python set:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;guessed_letters&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;guess_letter&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;guessed_letters&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;You already guessed that letter!&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This was a good practical example of learning a data structure and actually using it in a real project, rather than just doing exercises.&lt;/p&gt;

&lt;h3&gt;
  
  
  Breaking the Game Into Responsibilities
&lt;/h3&gt;

&lt;p&gt;My v2.0 structure now looks like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;main()
  ↓
play_game()
  ├── generating_word()
  ├── generating_blanks()
  ├── getting_input()
  ├── input_validation()
  ├── replacing_blanks()
  └── game_win_lose()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is one of the biggest things I learned from this project. A function shouldn't just exist because "functions are good." It should have a clear responsibility.&lt;/p&gt;




&lt;h2&gt;
  
  
  What I Learned From the Refactoring
&lt;/h2&gt;

&lt;p&gt;The biggest lesson wasn't about syntax. It was about &lt;strong&gt;thinking differently about code&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;When I first started programming, I mostly focused on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"Does my code work?"&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now I'm slowly learning to ask:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"Is my code organized?"&lt;/li&gt;
&lt;li&gt;"Can I understand it later?"&lt;/li&gt;
&lt;li&gt;"Can I change one part without breaking everything?"&lt;/li&gt;
&lt;li&gt;"Does each function have a clear purpose?"&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I definitely still have a lot to learn, but I think this project was an important step in that direction.&lt;/p&gt;




&lt;h2&gt;
  
  
  What I Still Need to Improve
&lt;/h2&gt;

&lt;p&gt;My Hangman v2.0 isn't perfect. There are still things I can improve:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Being more careful about when to validate input versus when to store it&lt;/li&gt;
&lt;li&gt;Removing unnecessary return values&lt;/li&gt;
&lt;li&gt;Better error handling&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These are small things, but that's exactly why I'm documenting them. &lt;strong&gt;I don't want to only show the final version and pretend I knew everything from the beginning.&lt;/strong&gt; The mistakes are part of the learning process.&lt;/p&gt;




&lt;h2&gt;
  
  
  v1.0 → v2.0: The Progression
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Version&lt;/th&gt;
&lt;th&gt;Main Focus&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;v1.0&lt;/td&gt;
&lt;td&gt;Make the game work&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;v2.0&lt;/td&gt;
&lt;td&gt;Improve structure and reliability&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Future&lt;/td&gt;
&lt;td&gt;Further improvements as I learn&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;v1.0 taught me how to build the game.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;v2.0 taught me how to think about improving the code.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;And I think that difference is important.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Biggest Takeaway
&lt;/h2&gt;

&lt;p&gt;If I had to summarize what this project taught me in one sentence, it would be this:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The most important part of learning to code isn't writing code that works—it's writing code that you (and others) can understand, maintain, and improve.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This shift in thinking will probably make more of a difference in my programming journey than any specific syntax I've learned.&lt;/p&gt;




&lt;h2&gt;
  
  
  What's Next?
&lt;/h2&gt;

&lt;p&gt;I'm continuing my Python journey by building more projects rather than only following tutorials. My goal isn't to rush through Python topics—it's to understand concepts well enough that I can approach new problems with confidence.&lt;/p&gt;

&lt;p&gt;There will probably be plenty of bugs, bad code, rewrites, and moments where I wonder why something isn't working. But that's part of learning.&lt;/p&gt;

&lt;p&gt;I'll be documenting this journey here.&lt;/p&gt;

&lt;p&gt;This is only the beginning.&lt;/p&gt;




&lt;h2&gt;
  
  
  Let's Connect
&lt;/h2&gt;

&lt;p&gt;If you're also learning to code, I'd love to hear about your journey! What projects are you building? What mistakes are you making? Drop a comment below—I promise I'm making plenty of my own.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Project Links:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/tehreem-fatima-dev/hangman_game" rel="noopener noreferrer"&gt;https://github.com/tehreem-fatima-dev/hangman_game&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.udemy.com/course/100-days-of-code/" rel="noopener noreferrer"&gt;Day 7 of 100 Days of Code by Dr. Angela Yu&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




</description>
      <category>python</category>
      <category>learning</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
