<?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: still-purrfect</title>
    <description>The latest articles on DEV Community by still-purrfect (@stillpurrfect).</description>
    <link>https://dev.to/stillpurrfect</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%2F3952210%2F39152791-8a4c-400d-90dc-2f978d5b3e5e.png</url>
      <title>DEV Community: still-purrfect</title>
      <link>https://dev.to/stillpurrfect</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/stillpurrfect"/>
    <language>en</language>
    <item>
      <title>Working With .txt Files in Python: Simple but Powerful</title>
      <dc:creator>still-purrfect</dc:creator>
      <pubDate>Mon, 08 Jun 2026 13:38:35 +0000</pubDate>
      <link>https://dev.to/stillpurrfect/working-with-txt-files-in-python-simple-but-powerful-3952</link>
      <guid>https://dev.to/stillpurrfect/working-with-txt-files-in-python-simple-but-powerful-3952</guid>
      <description>&lt;p&gt;Not every file is complex.&lt;br&gt;
Sometimes, all you need is a simple text file.&lt;br&gt;
And that’s exactly where &lt;code&gt;.txt&lt;/code&gt; files come in.&lt;br&gt;
With file handling, we’ve learned how Python can read and write data.&lt;br&gt;
Now let’s make it more practical by focusing on one of the simplest and most commonly used file types: &lt;strong&gt;.txt files&lt;/strong&gt;.&lt;br&gt;
A &lt;code&gt;.txt&lt;/code&gt; file is just a plain text file. No formatting, no special structure just raw text.&lt;/p&gt;
&lt;h2&gt;
  
  
  🔹 Writing to a .txt File
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nb"&gt;file&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;notes.txt&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;w&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nb"&gt;file&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;This is my first text file.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nb"&gt;file&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;close&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;This creates a file called &lt;code&gt;notes.txt&lt;/code&gt; and writes content into it.&lt;/p&gt;
&lt;h2&gt;
  
  
  🔹 Reading from a .txt File
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nb"&gt;file&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;notes.txt&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;r&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;content&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;file&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read&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="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nb"&gt;file&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;close&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;This reads everything inside the file.&lt;/p&gt;
&lt;h2&gt;
  
  
  🔹 Adding More Content
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nb"&gt;file&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;notes.txt&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;a&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nb"&gt;file&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;write&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="s"&gt;This is a new line.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nb"&gt;file&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;close&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;This adds new content without deleting what was already there.&lt;/p&gt;
&lt;h2&gt;
  
  
  🔹 Using "with" (Better Practice)
&lt;/h2&gt;

&lt;p&gt;Instead of manually closing files, Python gives a cleaner way:&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;with&lt;/span&gt; &lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;notes.txt&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;r&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nb"&gt;file&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;content&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;file&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read&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="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This automatically handles closing the file.&lt;/p&gt;

&lt;h2&gt;
  
  
  💡 Why .txt Files Matter
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;.txt&lt;/code&gt; files are simple, but very useful:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Storing notes&lt;/li&gt;
&lt;li&gt;Saving logs&lt;/li&gt;
&lt;li&gt;Writing simple data&lt;/li&gt;
&lt;li&gt;Testing file handling concepts
They are often the starting point before moving into more complex file types like CSV or databases.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🌱 Challenge
&lt;/h3&gt;

&lt;p&gt;Create a program that:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Writes your name and a short message into a &lt;code&gt;.txt&lt;/code&gt; file&lt;/li&gt;
&lt;li&gt;Reads the file and prints the content&lt;/li&gt;
&lt;li&gt;Adds another line to the file.
Keep it simple and focus on understanding the flow.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Next, we’ll move into &lt;a href="https://dev.to/stillpurrfect/exception-handling-in-python-making-your-code-fail-safely-32i2"&gt;&lt;strong&gt;exception handling&lt;/strong&gt;,&lt;/a&gt; where your program learns how to deal with errors when working with files and user input.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>programming</category>
      <category>python</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Inheritance in Python: Building Code That Grows With You</title>
      <dc:creator>still-purrfect</dc:creator>
      <pubDate>Mon, 08 Jun 2026 09:05:54 +0000</pubDate>
      <link>https://dev.to/stillpurrfect/inheritance-in-python-building-code-that-grows-with-you-261c</link>
      <guid>https://dev.to/stillpurrfect/inheritance-in-python-building-code-that-grows-with-you-261c</guid>
      <description>&lt;p&gt;What if you didn’t have to rewrite code every time you wanted something similar?&lt;br&gt;
What if you could build on what already exists?&lt;br&gt;
That’s exactly what inheritance does.&lt;br&gt;
So far, we’ve learned how to create classes and objects, and how they help us model real-world things in code.&lt;br&gt;
Now we take it one step further: &lt;strong&gt;inheritance&lt;/strong&gt;.&lt;br&gt;
Inheritance allows one class to use the properties and methods of another class.&lt;br&gt;
In simple terms, it means: &lt;em&gt;build once, reuse and extend.&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  🔹 The Parent Class
&lt;/h2&gt;

&lt;p&gt;A parent class is the original class.&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;class&lt;/span&gt; &lt;span class="nc"&gt;Animal&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;speak&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&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;Animal makes a sound&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;h2&gt;
  
  
  🔹 The Child Class
&lt;/h2&gt;

&lt;p&gt;A child class inherits from the parent class.&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;class&lt;/span&gt; &lt;span class="nc"&gt;Dog&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Animal&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;pass&lt;/span&gt;

&lt;span class="n"&gt;dog1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Dog&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;dog1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;speak&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Even though &lt;code&gt;Dog&lt;/code&gt; has no method of its own, it can still use &lt;code&gt;speak()&lt;/code&gt; from &lt;code&gt;Animal&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  🔹 Overriding Methods
&lt;/h2&gt;

&lt;p&gt;A child class can also change how a method works.&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;class&lt;/span&gt; &lt;span class="nc"&gt;Dog&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Animal&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;speak&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&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;Dog barks&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;dog1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Dog&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;dog1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;speak&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now the child class replaces the parent behavior.&lt;/p&gt;

&lt;h2&gt;
  
  
  💡 Why Inheritance Matters
&lt;/h2&gt;

&lt;p&gt;Inheritance helps you:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Reuse code instead of repeating it&lt;/li&gt;
&lt;li&gt;Organize programs better&lt;/li&gt;
&lt;li&gt;Build scalable systems&lt;/li&gt;
&lt;li&gt;Represent real-world relationships
In real applications, inheritance is used in everything from games to banking systems.
It helps code grow without becoming messy.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🌱 Final Challenge
&lt;/h3&gt;

&lt;p&gt;Create:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A parent class called &lt;code&gt;Vehicle&lt;/code&gt; with a method &lt;code&gt;move()&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;A child class called &lt;code&gt;Car&lt;/code&gt; that inherits from &lt;code&gt;Vehicle&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Override the &lt;code&gt;move()&lt;/code&gt; method in &lt;code&gt;Car&lt;/code&gt; to print something different
Then create an object of &lt;code&gt;Car&lt;/code&gt; and call the method.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  🎯 Final Note
&lt;/h3&gt;

&lt;p&gt;If you’ve followed all the topics in this series, you now understand the foundation of programming from basic data to object-oriented thinking.&lt;/p&gt;

&lt;p&gt;This is the point where you stop just learning syntax… and start thinking like a developer.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>programming</category>
      <category>python</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Sets in Python: Working With Unique Values</title>
      <dc:creator>still-purrfect</dc:creator>
      <pubDate>Mon, 08 Jun 2026 08:59:04 +0000</pubDate>
      <link>https://dev.to/stillpurrfect/sets-in-python-working-with-unique-values-3i68</link>
      <guid>https://dev.to/stillpurrfect/sets-in-python-working-with-unique-values-3i68</guid>
      <description>&lt;p&gt;Have you ever had duplicate data and wished you could just remove repeats automatically?&lt;br&gt;
That’s exactly what sets do.&lt;br&gt;
So far, we’ve worked with lists, tuples, dictionaries, and other data types.&lt;br&gt;
Now we’re looking at something simpler but very powerful: &lt;strong&gt;sets&lt;/strong&gt;.&lt;br&gt;
A set is a collection of items that does not allow duplicates.&lt;/p&gt;

&lt;h2&gt;
  
  
  🔹 Creating a Set
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;numbers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&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="n"&gt;numbers&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Sets use curly brackets, just like dictionaries but they only store values.&lt;/p&gt;

&lt;h2&gt;
  
  
  🔹 Removing Duplicates Automatically
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;numbers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&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="n"&gt;numbers&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output:&lt;br&gt;
&lt;code&gt;{1, 2, 3, 4, 5}&lt;/code&gt;&lt;br&gt;
Duplicates are automatically removed.&lt;/p&gt;

&lt;h2&gt;
  
  
  🔹 Adding Items to a Set
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;numbers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="n"&gt;numbers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;4&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="n"&gt;numbers&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  🔹 Removing Items
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;numbers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="n"&gt;numbers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;remove&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&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="n"&gt;numbers&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  💡 Why Sets Matter
&lt;/h2&gt;

&lt;p&gt;Sets are useful when you need:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Unique values only&lt;/li&gt;
&lt;li&gt;Fast membership checks&lt;/li&gt;
&lt;li&gt;Cleaned-up data
They are often used in:&lt;/li&gt;
&lt;li&gt;Data cleaning&lt;/li&gt;
&lt;li&gt;Removing duplicates from lists&lt;/li&gt;
&lt;li&gt;Comparing groups of items&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Think of sets as a “no repetition allowed” container.&lt;/p&gt;

&lt;h3&gt;
  
  
  🌱 Challenge
&lt;/h3&gt;

&lt;p&gt;Write a program that:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Creates a list with repeated numbers&lt;/li&gt;
&lt;li&gt;Converts it into a set&lt;/li&gt;
&lt;li&gt;Prints the cleaned unique values&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Bonus: Try adding a new number to the set and printing it again.&lt;/p&gt;

&lt;p&gt;Next, we’ll explore &lt;a href="https://dev.to/stillpurrfect/inheritance-in-python-building-code-that-grows-with-you-261c"&gt;&lt;strong&gt;inheritance&lt;/strong&gt;,&lt;/a&gt; where you learn how classes can build on each other like real systems in software development.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>programming</category>
      <category>python</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Date and Time in Python: Working With Real-World Moments</title>
      <dc:creator>still-purrfect</dc:creator>
      <pubDate>Mon, 08 Jun 2026 08:52:46 +0000</pubDate>
      <link>https://dev.to/stillpurrfect/date-and-time-in-python-working-with-real-world-moments-3110</link>
      <guid>https://dev.to/stillpurrfect/date-and-time-in-python-working-with-real-world-moments-3110</guid>
      <description>&lt;p&gt;Every app you use alarms, calendars and reminders depends on one thing:&lt;br&gt;
Time.&lt;br&gt;
So far, we’ve learned how to write programs that store data, make decisions, handle errors, and work with files.&lt;br&gt;
Now we move into something more practical: &lt;strong&gt;date and time&lt;/strong&gt;.&lt;br&gt;
Python allows us to work with time using the built-in &lt;code&gt;datetime&lt;/code&gt; module.&lt;/p&gt;
&lt;h2&gt;
  
  
  🔹 Getting the Current Date and Time
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;

&lt;span class="n"&gt;now&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&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="n"&gt;now&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;This prints the current date and time from your system.&lt;/p&gt;
&lt;h2&gt;
  
  
  🔹 Working with Dates Only
&lt;/h2&gt;

&lt;p&gt;Sometimes you only need the date.&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="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;

&lt;span class="n"&gt;today&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;today&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="n"&gt;today&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This gives only the current date.&lt;/p&gt;

&lt;h2&gt;
  
  
  🔹 Creating Your Own Date
&lt;/h2&gt;

&lt;p&gt;You can also create a specific date.&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="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;

&lt;span class="n"&gt;birthday&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;date&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;17&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="n"&gt;birthday&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  🔹 Formatting Date and Time
&lt;/h2&gt;

&lt;p&gt;Raw date formats can look messy, so we format them.&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="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;

&lt;span class="n"&gt;now&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&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="n"&gt;now&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;strftime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;%Y-%m-%d&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 gives a clean format like:&lt;br&gt;
&lt;code&gt;2026-06-08&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  💡 Why Date and Time Matter
&lt;/h2&gt;

&lt;p&gt;Date and time are used in:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Reminders ⏰&lt;/li&gt;
&lt;li&gt;Scheduling apps 📅&lt;/li&gt;
&lt;li&gt;Login systems 🔐&lt;/li&gt;
&lt;li&gt;Logs in applications 📊&lt;/li&gt;
&lt;li&gt;Automated tasks 🤖
Almost every real system tracks time in some way.
Without it, apps would feel static and unorganized.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🌱 Challenge
&lt;/h3&gt;

&lt;p&gt;Write a program that:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Displays today’s date&lt;/li&gt;
&lt;li&gt;Asks the user for their birth year&lt;/li&gt;
&lt;li&gt;Calculates their age
Bonus: Format the output in a clean sentence.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Next, we’ll explore &lt;a href="https://dev.to/stillpurrfect/sets-in-python-working-with-unique-values-3i68"&gt;&lt;strong&gt;sets&lt;/strong&gt;,&lt;/a&gt; where you learn how to store unique values and remove duplicates automatically.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>programming</category>
      <category>python</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Exception Handling in Python: Making Your Code Fail Safely</title>
      <dc:creator>still-purrfect</dc:creator>
      <pubDate>Mon, 08 Jun 2026 08:45:23 +0000</pubDate>
      <link>https://dev.to/stillpurrfect/exception-handling-in-python-making-your-code-fail-safely-32i2</link>
      <guid>https://dev.to/stillpurrfect/exception-handling-in-python-making-your-code-fail-safely-32i2</guid>
      <description>&lt;p&gt;What happens when your program runs into an error?&lt;br&gt;
Without preparation… it just stops.&lt;br&gt;
And that’s not something real applications can afford.&lt;br&gt;
So far, we’ve learned how to write programs that store data, make decisions, repeat actions, and even work with files.&lt;br&gt;
But in real life, things don’t always go as expected.&lt;br&gt;
Users enter wrong input, files may be missing, or calculations may fail.&lt;br&gt;
That’s where &lt;strong&gt;exception handling&lt;/strong&gt; comes in.&lt;/p&gt;
&lt;h2&gt;
  
  
  🔹 What is an Exception?
&lt;/h2&gt;

&lt;p&gt;An exception is an error that occurs while a program is running.&lt;br&gt;
For example:&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="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This causes an error because you cannot divide by zero.&lt;br&gt;
Without handling it, the program crashes immediately.&lt;/p&gt;
&lt;h2&gt;
  
  
  🔹 Using Try and Except
&lt;/h2&gt;

&lt;p&gt;Python allows us to handle errors using &lt;code&gt;try&lt;/code&gt; and &lt;code&gt;except&lt;/code&gt;.&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;try&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="mi"&gt;10&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;except&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;Something went wrong&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;Instead of crashing, the program handles the error gracefully.&lt;/p&gt;

&lt;h2&gt;
  
  
  🔹 Handling Specific Errors
&lt;/h2&gt;

&lt;p&gt;You can also handle specific types of errors.&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;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;number&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;int&lt;/span&gt;&lt;span class="p"&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;Enter a number: &lt;/span&gt;&lt;span class="sh"&gt;"&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="mi"&gt;10&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;number&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nb"&gt;ZeroDivisionError&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 cannot divide by zero&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nb"&gt;ValueError&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;Please enter a valid number&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;Now the program knows exactly what went wrong.&lt;/p&gt;

&lt;h2&gt;
  
  
  🔹 Finally Block
&lt;/h2&gt;

&lt;p&gt;There is also a &lt;code&gt;finally&lt;/code&gt; block that always runs.&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;try&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;Trying something...&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;except&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;Error occurred&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;finally&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;This will always run&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 is often used for cleanup actions like closing files.&lt;/p&gt;

&lt;h2&gt;
  
  
  💡 Why Exception Handling Matters
&lt;/h2&gt;

&lt;p&gt;Exception handling makes your program:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;More stable&lt;/li&gt;
&lt;li&gt;More user-friendly&lt;/li&gt;
&lt;li&gt;Less likely to crash&lt;/li&gt;
&lt;li&gt;Ready for real-world use
In real applications, errors are not avoided they are managed.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🌱 Challenge
&lt;/h3&gt;

&lt;p&gt;Write a program that:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Asks the user to enter a number&lt;/li&gt;
&lt;li&gt;Divides 100 by that number&lt;/li&gt;
&lt;li&gt;Handles:

&lt;ul&gt;
&lt;li&gt;Zero division error&lt;/li&gt;
&lt;li&gt;Invalid input error
Make sure your program never crashes, no matter what is entered.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Next, we’ll explore &lt;a href="https://dev.to/stillpurrfect/date-and-time-in-python-working-with-real-world-moments-3110"&gt;&lt;strong&gt;date and time&lt;/strong&gt;,&lt;/a&gt; where your programs learn how to work with real-world time-based data like schedules and timestamps.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>programming</category>
      <category>python</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>File Handling in Python: Working With Real Data</title>
      <dc:creator>still-purrfect</dc:creator>
      <pubDate>Mon, 08 Jun 2026 08:32:37 +0000</pubDate>
      <link>https://dev.to/stillpurrfect/file-handling-in-python-working-with-real-data-5g43</link>
      <guid>https://dev.to/stillpurrfect/file-handling-in-python-working-with-real-data-5g43</guid>
      <description>&lt;p&gt;So far, everything we’ve done exists only inside the program.&lt;br&gt;
But what if your program could remember things even after it closes?&lt;br&gt;
That’s where &lt;strong&gt;file handling&lt;/strong&gt; comes in.&lt;br&gt;
So far, we’ve worked with variables, functions, and modules.&lt;br&gt;
But in real applications, data doesn’t just disappear when a program stops running.&lt;br&gt;
It is saved in files like &lt;code&gt;.txt&lt;/code&gt;, &lt;code&gt;.csv&lt;/code&gt;, or databases.&lt;br&gt;
Python allows us to work with these files using &lt;strong&gt;file handling&lt;/strong&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  🔹 Opening a File
&lt;/h2&gt;

&lt;p&gt;To work with a file, we first open it using &lt;code&gt;open()&lt;/code&gt;.&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="nb"&gt;file&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;file.txt&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;r&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;The &lt;code&gt;"r"&lt;/code&gt; means &lt;strong&gt;read mode&lt;/strong&gt; (we are only reading the file).&lt;/p&gt;

&lt;h2&gt;
  
  
  🔹 Reading a File
&lt;/h2&gt;

&lt;p&gt;Once the file is open, we can read its content.&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="nb"&gt;file&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;file.txt&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;r&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;content&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;file&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read&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="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nb"&gt;file&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;close&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Always remember to close the file after using it.&lt;/p&gt;

&lt;h2&gt;
  
  
  🔹 Writing to a File
&lt;/h2&gt;

&lt;p&gt;We can also create or write into files using &lt;code&gt;"w"&lt;/code&gt; mode.&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="nb"&gt;file&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;file.txt&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;w&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nb"&gt;file&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Hello, this is my first file.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nb"&gt;file&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;close&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;⚠️ Note: Writing mode will overwrite existing content.&lt;/p&gt;

&lt;h2&gt;
  
  
  🔹 Appending to a File
&lt;/h2&gt;

&lt;p&gt;If you don’t want to overwrite, use &lt;code&gt;"a"&lt;/code&gt; mode.&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="nb"&gt;file&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;file.txt&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;a&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nb"&gt;file&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;write&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="s"&gt;This is an additional line.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nb"&gt;file&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;close&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This adds new content without deleting old data.&lt;/p&gt;

&lt;h2&gt;
  
  
  💡 Why File Handling Matters
&lt;/h2&gt;

&lt;p&gt;File handling allows your programs to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Save user data&lt;/li&gt;
&lt;li&gt;Store results&lt;/li&gt;
&lt;li&gt;Keep records&lt;/li&gt;
&lt;li&gt;Work like real applications
Without it, everything resets once the program stops.
With it, your program can actually &lt;em&gt;remember things&lt;/em&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🌱 Challenge
&lt;/h3&gt;

&lt;p&gt;Create a program that:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Writes your name and age into a file&lt;/li&gt;
&lt;li&gt;Opens the file again&lt;/li&gt;
&lt;li&gt;Reads and prints the content
Try also appending a new line after that.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Next, we’ll explore &lt;a href="https://dev.to/stillpurrfect/exception-handling-in-python-making-your-code-fail-safely-32i2"&gt;&lt;strong&gt;exception handling&lt;/strong&gt;,&lt;/a&gt; where your program learns how to handle errors without crashing.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>codenewbie</category>
      <category>python</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Modules in Programming: Using and Organizing Code Like a Pro</title>
      <dc:creator>still-purrfect</dc:creator>
      <pubDate>Mon, 08 Jun 2026 08:22:43 +0000</pubDate>
      <link>https://dev.to/stillpurrfect/modules-in-programming-using-and-organizing-code-like-a-pro-3pfb</link>
      <guid>https://dev.to/stillpurrfect/modules-in-programming-using-and-organizing-code-like-a-pro-3pfb</guid>
      <description>&lt;p&gt;What if you didn’t have to write everything from scratch every time you code?&lt;br&gt;
That’s exactly what modules help you do.&lt;br&gt;
So far, we’ve learned how to write functions and even shorten them using lambda functions.&lt;br&gt;
But as programs grow, keeping everything in one file becomes messy.&lt;br&gt;
That’s where &lt;strong&gt;modules&lt;/strong&gt; come in.&lt;br&gt;
A module is simply a file that contains Python code functions, variables, or classes that you can reuse in other programs.&lt;/p&gt;
&lt;h2&gt;
  
  
  🔹 Using Built-in Modules
&lt;/h2&gt;

&lt;p&gt;Python already comes with ready made modules.&lt;br&gt;
For example, the &lt;code&gt;math&lt;/code&gt; module:&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="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;math&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sqrt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;16&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This calculates the square root of 16.&lt;br&gt;
Instead of writing the logic yourself, you just use what already exists.&lt;/p&gt;
&lt;h2&gt;
  
  
  🔹 Importing Specific Features
&lt;/h2&gt;

&lt;p&gt;Sometimes you don’t need the whole module just one part.&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="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;math&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;sqrt&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;sqrt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;25&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This imports only the square root function.&lt;/p&gt;

&lt;h2&gt;
  
  
  🔹 Creating Your Own Module
&lt;/h2&gt;

&lt;p&gt;You can also create your own module.&lt;br&gt;
Imagine you have a file called &lt;code&gt;my_functions.py&lt;/code&gt;:&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;greet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Hello &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you can use it in another file:&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="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;my_functions&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;my_functions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Mary&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;h2&gt;
  
  
  🔹 Why Modules Matter
&lt;/h2&gt;

&lt;p&gt;Modules help you:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Organize your code&lt;/li&gt;
&lt;li&gt;Reuse functions easily&lt;/li&gt;
&lt;li&gt;Keep programs clean&lt;/li&gt;
&lt;li&gt;Work on bigger projects without confusion
In real development, no one writes everything in one file. Modules make large systems manageable.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🌱 Challenge
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Import the &lt;code&gt;math&lt;/code&gt; module&lt;/li&gt;
&lt;li&gt;Use it to:

&lt;ul&gt;
&lt;li&gt;Find the square root of 49&lt;/li&gt;
&lt;li&gt;Find the value of pi (&lt;code&gt;math.pi&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Then create your own module with a function that:

&lt;ul&gt;
&lt;li&gt;Takes a name&lt;/li&gt;
&lt;li&gt;Returns a greeting
Try importing it into another file and using it.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Next, we’ll explore &lt;a href="https://dev.to/stillpurrfect/file-handling-in-python-working-with-real-data-5g43"&gt;&lt;strong&gt;file handling&lt;/strong&gt;,&lt;/a&gt; where your programs start working with real files like &lt;code&gt;.txt&lt;/code&gt; just like real applications do.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>programming</category>
      <category>python</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Lambda Functions in Programming: Short, Simple, and Powerful</title>
      <dc:creator>still-purrfect</dc:creator>
      <pubDate>Mon, 08 Jun 2026 08:12:08 +0000</pubDate>
      <link>https://dev.to/stillpurrfect/lambda-functions-in-programming-short-simple-and-powerful-4eoi</link>
      <guid>https://dev.to/stillpurrfect/lambda-functions-in-programming-short-simple-and-powerful-4eoi</guid>
      <description>&lt;p&gt;Sometimes you don’t need a full function… just a quick one-liner.&lt;br&gt;
That’s exactly what lambda functions are for.&lt;br&gt;
So far, we’ve learned how to create functions using &lt;code&gt;def&lt;/code&gt;.&lt;br&gt;
Those are great for larger tasks.&lt;br&gt;
But in programming, there are moments where you need something very small, very fast, and temporary.&lt;br&gt;
That’s where &lt;strong&gt;lambda functions&lt;/strong&gt; come in.&lt;br&gt;
A lambda function is a short way of writing a function in a single line.&lt;/p&gt;
&lt;h2&gt;
  
  
  🔹 Basic Lambda Function
&lt;/h2&gt;

&lt;p&gt;Instead of writing a full function like this:&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;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&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;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can write it using lambda:&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;add&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;lambda&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Same result. Less code.&lt;/p&gt;

&lt;h2&gt;
  
  
  🔹 How It Works
&lt;/h2&gt;

&lt;p&gt;A lambda function:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Has no name (or a temporary one)&lt;/li&gt;
&lt;li&gt;Is written in one line&lt;/li&gt;
&lt;li&gt;Is used for simple tasks
Structure:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;lambda&lt;/span&gt; &lt;span class="n"&gt;arguments&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;expression&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  🔹 Example: Multiply Numbers
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;multiply&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;lambda&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;multiply&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  🔹 When to Use Lambda
&lt;/h2&gt;

&lt;p&gt;Lambda functions are useful when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You need a small function quickly&lt;/li&gt;
&lt;li&gt;You don’t want to define a full function&lt;/li&gt;
&lt;li&gt;You are working with built-in functions like &lt;code&gt;map()&lt;/code&gt; or &lt;code&gt;filter()&lt;/code&gt; (we’ll get there later)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  💡 Why Lambda Matters
&lt;/h2&gt;

&lt;p&gt;Lambda functions are not about replacing normal functions.&lt;br&gt;
They are about simplicity.&lt;br&gt;
They help you write cleaner code when the task is small and straightforward.&lt;br&gt;
Think of them as shortcuts not replacements.&lt;/p&gt;

&lt;h3&gt;
  
  
  🌱 Challenge
&lt;/h3&gt;

&lt;p&gt;Write a lambda function that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Takes one number&lt;/li&gt;
&lt;li&gt;Returns the square of that number
Then:&lt;/li&gt;
&lt;li&gt;Test it with at least 3 different numbers
Try also writing the same thing using a normal function and compare the two.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Next, we’ll explore &lt;a href="https://dev.to/stillpurrfect/modules-in-programming-using-and-organizing-code-like-a-pro-3pfb"&gt;&lt;strong&gt;modules&lt;/strong&gt;,&lt;/a&gt; where you learn how to use code written by other people and organize your own like a real project.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>programming</category>
      <category>python</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Functions in Programming: Writing Code Once, Using It Anytime</title>
      <dc:creator>still-purrfect</dc:creator>
      <pubDate>Mon, 08 Jun 2026 08:03:56 +0000</pubDate>
      <link>https://dev.to/stillpurrfect/functions-in-programming-writing-code-once-using-it-anytime-l8j</link>
      <guid>https://dev.to/stillpurrfect/functions-in-programming-writing-code-once-using-it-anytime-l8j</guid>
      <description>&lt;p&gt;What if you never had to rewrite the same code twice?&lt;br&gt;
That’s exactly what functions help you do.&lt;br&gt;
So far, we’ve worked with data, logic, repetition, and text.&lt;br&gt;
But as programs grow, writing everything step by step becomes messy.&lt;br&gt;
That’s where &lt;strong&gt;functions&lt;/strong&gt; come in.&lt;br&gt;
A function is a block of code that performs a specific task. You define it once, and reuse it whenever needed.&lt;/p&gt;
&lt;h2&gt;
  
  
  🔹 Creating a Function
&lt;/h2&gt;

&lt;p&gt;In Python, we use the keyword &lt;code&gt;def&lt;/code&gt; to define a function.&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;greet&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;Hello, welcome!&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;To use it, we call it:&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="nf"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  🔹 Functions with Parameters
&lt;/h2&gt;

&lt;p&gt;Functions become more powerful when they can accept input.&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;greet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;name&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;Hello &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nf"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Mary&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;Now the function can work with different names.&lt;/p&gt;

&lt;h2&gt;
  
  
  🔹 Functions with Multiple Inputs
&lt;/h2&gt;

&lt;p&gt;You can pass more than one value into a function.&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;add_numbers&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&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="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nf"&gt;add_numbers&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This makes your code flexible and reusable.&lt;/p&gt;

&lt;h2&gt;
  
  
  🔹 Return Values
&lt;/h2&gt;

&lt;p&gt;Sometimes you don’t just want to print a result you want to use it later.&lt;br&gt;
That’s where &lt;code&gt;return&lt;/code&gt; comes in.&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;multiply&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&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;a&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;

&lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;multiply&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&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="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now the result can be stored and reused.&lt;/p&gt;

&lt;h2&gt;
  
  
  💡 Why Functions Matter
&lt;/h2&gt;

&lt;p&gt;Functions help you:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Avoid repeating code&lt;/li&gt;
&lt;li&gt;Organize your program better&lt;/li&gt;
&lt;li&gt;Make your code easier to read&lt;/li&gt;
&lt;li&gt;Reuse logic anywhere in your program
In real applications, functions are everywhere. Without them, programs would be long, messy, and hard to manage.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🌱 Challenge
&lt;/h3&gt;

&lt;p&gt;Write a function that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Takes a name and age as input&lt;/li&gt;
&lt;li&gt;Prints a sentence like:
“My name is ___ and I am ___ years old”
Then:&lt;/li&gt;
&lt;li&gt;Call the function at least 2 times with different values
Try to think of it as building a small reusable tool.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Next, we’ll explore &lt;a href="https://dev.to/stillpurrfect/lambda-functions-in-programming-short-simple-and-powerful-4eoi"&gt;&lt;strong&gt;lambda functions&lt;/strong&gt;,&lt;/a&gt; a shorter way of writing functions used in more advanced Python code.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>programming</category>
      <category>python</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Strings in Programming: Working With Text Like a Pro</title>
      <dc:creator>still-purrfect</dc:creator>
      <pubDate>Mon, 08 Jun 2026 07:54:38 +0000</pubDate>
      <link>https://dev.to/stillpurrfect/strings-in-programming-working-with-text-like-a-pro-147e</link>
      <guid>https://dev.to/stillpurrfect/strings-in-programming-working-with-text-like-a-pro-147e</guid>
      <description>&lt;p&gt;Everything you see on a screen messages, names, passwords, even emails is basically text.&lt;br&gt;
In programming, that text is called a &lt;strong&gt;string&lt;/strong&gt;.&lt;br&gt;
So far, we’ve worked with numbers, logic, and repetition.&lt;br&gt;
Now we move into something even more common in real applications: &lt;strong&gt;text data&lt;/strong&gt;.&lt;br&gt;
A string is simply a sequence of characters inside quotes.&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;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Mary&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  🔹 Creating Strings
&lt;/h2&gt;

&lt;p&gt;Strings can be written using either single or double quotes:&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;text1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Hello&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="n"&gt;text2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;World&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Both are valid. Just be consistent.&lt;/p&gt;

&lt;h2&gt;
  
  
  🔹 String Concatenation (Joining Text)
&lt;/h2&gt;

&lt;p&gt;You can combine strings using the &lt;code&gt;+&lt;/code&gt; operator.&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;first_name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Mary&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="n"&gt;last_name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Akinyi&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;first_name&lt;/span&gt; &lt;span class="o"&gt;+&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="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;last_name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This joins the two strings into one full name.&lt;/p&gt;

&lt;h2&gt;
  
  
  🔹 Accessing Characters
&lt;/h2&gt;

&lt;p&gt;Strings are like a sequence of letters. Each character has a position (index).&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;word&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Python&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

&lt;span class="nf"&gt;print&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="mi"&gt;0&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="n"&gt;word&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This prints:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;P&lt;/li&gt;
&lt;li&gt;y&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Remember: indexing starts from 0.&lt;/p&gt;

&lt;h2&gt;
  
  
  🔹 String Length
&lt;/h2&gt;

&lt;p&gt;You can find how long a string is using &lt;code&gt;len()&lt;/code&gt;.&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;word&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Python&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;len&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This returns the number of characters in the string.&lt;/p&gt;

&lt;h2&gt;
  
  
  💡 Why Strings Matter
&lt;/h2&gt;

&lt;p&gt;Strings are everywhere in programming:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;User names&lt;/li&gt;
&lt;li&gt;Messages&lt;/li&gt;
&lt;li&gt;Input from users&lt;/li&gt;
&lt;li&gt;Website content&lt;/li&gt;
&lt;li&gt;Passwords&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Almost every application depends on text in some way.&lt;br&gt;
Understanding strings gives you control over how programs communicate.&lt;/p&gt;

&lt;h3&gt;
  
  
  🌱 Challenge
&lt;/h3&gt;

&lt;p&gt;Write a program that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Takes a first name and last name&lt;/li&gt;
&lt;li&gt;Combines them into a full name&lt;/li&gt;
&lt;li&gt;Prints how many characters the full name has
Try to think about how strings are used in real applications, not just the example.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Next, we’ll explore &lt;a href="https://dev.to/stillpurrfect/functions-in-programming-writing-code-once-using-it-anytime-l8j"&gt;&lt;strong&gt;functions&lt;/strong&gt;,&lt;/a&gt; where you learn how to organize your code into reusable blocks like a real developer.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>codenewbie</category>
      <category>programming</category>
      <category>python</category>
    </item>
    <item>
      <title>Loops in Programming: How to Make Your Code Repeat Without Stress</title>
      <dc:creator>still-purrfect</dc:creator>
      <pubDate>Mon, 08 Jun 2026 07:40:20 +0000</pubDate>
      <link>https://dev.to/stillpurrfect/loops-in-programming-how-to-make-your-code-repeat-without-stress-3bp7</link>
      <guid>https://dev.to/stillpurrfect/loops-in-programming-how-to-make-your-code-repeat-without-stress-3bp7</guid>
      <description>&lt;p&gt;Have you ever written the same code again and again and thought there must be a better way?&lt;br&gt;
That’s exactly what loops solve.&lt;br&gt;
So far, we’ve learned how to store data, make decisions using if statements, and work with operators.&lt;br&gt;
But what if we want to repeat something multiple times?&lt;br&gt;
Instead of writing the same code over and over, we use &lt;strong&gt;loops&lt;/strong&gt;.&lt;br&gt;
Loops allow your program to repeat a block of code as many times as needed.&lt;/p&gt;
&lt;h2&gt;
  
  
  🔹 1. For Loop
&lt;/h2&gt;

&lt;p&gt;A for loop is used when you know how many times you want to repeat something.&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;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&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;Hello&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 prints “Hello” 5 times.&lt;/p&gt;

&lt;h2&gt;
  
  
  🔹 2. While Loop
&lt;/h2&gt;

&lt;p&gt;A while loop keeps running as long as a condition is true.&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;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;

&lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;5&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="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This prints numbers from 1 to 5.&lt;/p&gt;

&lt;h2&gt;
  
  
  💡 Why Loops Matter
&lt;/h2&gt;

&lt;p&gt;Loops save time and reduce repetition.&lt;br&gt;
Without loops, you repeat code manually.&lt;br&gt;
With loops, one line can do the work of many.&lt;br&gt;
They are one of the most important tools in programming because they make your code efficient and scalable.&lt;/p&gt;

&lt;h3&gt;
  
  
  🌱 Challenge
&lt;/h3&gt;

&lt;p&gt;Write a program that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Prints numbers from 1 to 10&lt;/li&gt;
&lt;li&gt;Then prints “Python is fun” 5 times&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Try to do it using both:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a for loop&lt;/li&gt;
&lt;li&gt;a while loop&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Next, we’ll explore &lt;a href="https://dev.to/stillpurrfect/strings-in-programming-working-with-text-like-a-pro-147e"&gt;&lt;strong&gt;strings&lt;/strong&gt;,&lt;/a&gt; where you learn how to work with text in a deeper and more practical way.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>programming</category>
      <category>python</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>If Statements in Programming: Teaching Your Code to Decide</title>
      <dc:creator>still-purrfect</dc:creator>
      <pubDate>Mon, 08 Jun 2026 07:33:11 +0000</pubDate>
      <link>https://dev.to/stillpurrfect/if-statements-in-programming-teaching-your-code-to-decide-7a9</link>
      <guid>https://dev.to/stillpurrfect/if-statements-in-programming-teaching-your-code-to-decide-7a9</guid>
      <description>&lt;p&gt;So far, we’ve learned how to store data, organize it, and even perform operations using operators.&lt;br&gt;
But most real programs don’t just run top to bottom.&lt;br&gt;
They make decisions.&lt;br&gt;
That’s where &lt;strong&gt;if statements&lt;/strong&gt; come in.&lt;br&gt;
An if statement allows your program to run certain code only when a condition is true.&lt;br&gt;
Think of it like a simple decision:&lt;br&gt;
“If this is true, do this. Otherwise, do something else.”&lt;/p&gt;
&lt;h3&gt;
  
  
  🔹 Basic If Statement
&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;age&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;18&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;age&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;18&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 are allowed to vote&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;In this case, the program checks the condition &lt;code&gt;age &amp;gt;= 18&lt;/code&gt;.&lt;br&gt;
If it is true, it runs the message.&lt;br&gt;
If not, it simply does nothing.&lt;/p&gt;
&lt;h3&gt;
  
  
  🔹 If...Else Statement
&lt;/h3&gt;

&lt;p&gt;Sometimes we want two outcomes.&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;age&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;16&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;age&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;18&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 are allowed to vote&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;else&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 are not allowed to vote&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;Now the program chooses between two paths.&lt;br&gt;
One for true, one for false.&lt;/p&gt;
&lt;h3&gt;
  
  
  🔹 If...Elif...Else
&lt;/h3&gt;

&lt;p&gt;When there are multiple conditions, we use &lt;code&gt;elif&lt;/code&gt;.&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;marks&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;75&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;marks&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;80&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;Grade A&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="n"&gt;marks&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;60&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;Grade B&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;else&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;Grade C&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;The program checks conditions from top to bottom and stops once one is true.&lt;/p&gt;

&lt;h3&gt;
  
  
  💡 Why If Statements Matter
&lt;/h3&gt;

&lt;p&gt;If statements are what make programs feel “intelligent.”&lt;br&gt;
Without them, everything would run the same way every time.&lt;br&gt;
With them, your program can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;React to input&lt;/li&gt;
&lt;li&gt;Make decisions&lt;/li&gt;
&lt;li&gt;Handle different situations
This is the beginning of logic in programming.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🌱 Challenge
&lt;/h3&gt;

&lt;p&gt;Write a program that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Takes a number (your choice)&lt;/li&gt;
&lt;li&gt;Checks if it is:

&lt;ul&gt;
&lt;li&gt;Greater than 0 → print "Positive"&lt;/li&gt;
&lt;li&gt;Less than 0 → print "Negative"&lt;/li&gt;
&lt;li&gt;Equal to 0 → print "Zero"
Try to think step by step. That’s how programming becomes easier.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;Next, we’ll look at &lt;a href="https://dev.to/stillpurrfect/loops-in-programming-how-to-make-your-code-repeat-without-stress-3bp7"&gt;&lt;strong&gt;loops&lt;/strong&gt;,&lt;/a&gt; where your program stops doing things once and starts repeating actions efficiently.&lt;/p&gt;

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