<?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: Hillary Nartey</title>
    <description>The latest articles on DEV Community by Hillary Nartey (@hillary_nartey).</description>
    <link>https://dev.to/hillary_nartey</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3928946%2Fbb8512cb-8a73-4af4-8a54-1e774d4a2270.jpeg</url>
      <title>DEV Community: Hillary Nartey</title>
      <link>https://dev.to/hillary_nartey</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hillary_nartey"/>
    <language>en</language>
    <item>
      <title># Day 2: Variables, Data Types &amp; Conditionals in Python — With a Real Project!</title>
      <dc:creator>Hillary Nartey</dc:creator>
      <pubDate>Mon, 18 May 2026 14:44:02 +0000</pubDate>
      <link>https://dev.to/hillary_nartey/-day-2-variables-data-types-conditionals-in-python-with-a-real-project-234m</link>
      <guid>https://dev.to/hillary_nartey/-day-2-variables-data-types-conditionals-in-python-with-a-real-project-234m</guid>
      <description>&lt;p&gt;&lt;em&gt;By Hillary Nartey | AI Data Specialist in Training&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Welcome Back!
&lt;/h2&gt;

&lt;p&gt;This is Day 2 of my Python learning journey. If you missed Day 1, I shared how I got started, the free tools I am using, and why I chose Python as my first programming language.&lt;/p&gt;

&lt;p&gt;Today I covered three important Python basics:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Variables&lt;/li&gt;
&lt;li&gt;Data Types&lt;/li&gt;
&lt;li&gt;Conditionals (if, elif, else)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And the best part? I built a small real-world project to practice everything together!&lt;/p&gt;

&lt;p&gt;Variables&lt;/p&gt;

&lt;p&gt;A variable is simply a container that stores a value. Think of it like a labeled box where you keep information.&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;Hillary&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="n"&gt;age&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;25&lt;/span&gt;
&lt;span class="n"&gt;price&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;9.99&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each of these is a variable. &lt;code&gt;name&lt;/code&gt; stores text, &lt;code&gt;age&lt;/code&gt; stores a whole number, and &lt;code&gt;price&lt;/code&gt; stores a decimal number.&lt;/p&gt;

&lt;p&gt;Data Types&lt;/p&gt;

&lt;p&gt;In Python, every value has a &lt;strong&gt;data type&lt;/strong&gt;. Here are the basic ones I learned today:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Data Type&lt;/th&gt;
&lt;th&gt;Example&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;int&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;25&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Whole numbers&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;float&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;9.99&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Decimal numbers&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;str&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;"Hillary"&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Text (string)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;bool&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;True / False&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Yes or No values&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;You can also tell Python exactly what type a variable should be. 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="n"&gt;amount&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;int&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 your shopping amount: &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;Here I am telling Python that &lt;code&gt;amount&lt;/code&gt; should be an integer, and I am converting the user's input into one using &lt;code&gt;int()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Conditionals (if, elif, else)&lt;/p&gt;

&lt;p&gt;Conditionals let your program make decisions. It checks a condition and runs different code depending on whether it is TRUE or FALSE.&lt;/p&gt;

&lt;p&gt;The basic structure looks 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;if&lt;/span&gt; &lt;span class="n"&gt;condition&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="c1"&gt;# do this
&lt;/span&gt;&lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="n"&gt;another_condition&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="c1"&gt;# do this instead
&lt;/span&gt;&lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="c1"&gt;# do this if nothing above is true
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;My Mini Project: Shopping Discount Calculator 🛒&lt;/p&gt;

&lt;p&gt;To practice everything I learned today, I built a simple shopping discount calculator. It takes the amount a customer spends and automatically calculates their discount and final price.&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;amount&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;int&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 your shopping amount: &lt;/span&gt;&lt;span class="sh"&gt;"&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;amount&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;discount&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&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;No discount&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;amount&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;amount&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;99&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;discount&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.10&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 have 10% discount&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;amount&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;amount&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;199&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;discount&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.20&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 have 20% discount&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="n"&gt;discount&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.30&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 have 30% discount&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;final&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;amount&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="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;discount&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;final&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;150&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 a big spender&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;Great deal&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="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Your final price is: $&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;final&lt;/span&gt;&lt;span class="si"&gt;}&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;How it works:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The user enters how much they are spending&lt;/li&gt;
&lt;li&gt;The program checks which discount range they fall into&lt;/li&gt;
&lt;li&gt;It calculates the final price after the discount&lt;/li&gt;
&lt;li&gt;It also checks if the final amount makes them a "big spender."&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example, if you enter $120:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You get a 20% discount&lt;/li&gt;
&lt;li&gt;Your final price becomes $96.00&lt;/li&gt;
&lt;li&gt;And you get a "Great deal" message!&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What I Learned From This Project&lt;/p&gt;

&lt;p&gt;Building this small project taught me more than just reading about variables and conditionals. I learned how to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Take user input with &lt;code&gt;input()&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Convert data types using &lt;code&gt;int()&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Use multiple conditions with &lt;code&gt;elif&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Combine conditions using &lt;code&gt;and.&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Calculate values using arithmetic operators&lt;/li&gt;
&lt;li&gt;Display results using f-strings like &lt;code&gt;f"Your final price is: ${final}".&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Key Takeaways from Day 2&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Variables store information that your program can use&lt;/li&gt;
&lt;li&gt;Data types tell Python what kind of information is being stored&lt;/li&gt;
&lt;li&gt;Conditionals allow your program to make decisions&lt;/li&gt;
&lt;li&gt;The best way to learn is to build something — even something small!&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What's Coming on Day 3?&lt;/p&gt;

&lt;p&gt;Next, I plan to cover:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Lists — storing multiple values in one variable&lt;/li&gt;
&lt;li&gt;Loops — repeating actions automatically&lt;/li&gt;
&lt;li&gt;Another small project to practice!&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Thanks for following along! If you are also a beginner, drop a comment below — let's learn together! 🚀&lt;/p&gt;

&lt;p&gt;Written by Hillary Nartey | AI Data Specialist in Training&lt;/p&gt;

</description>
      <category>ai</category>
      <category>python</category>
      <category>beginners</category>
    </item>
    <item>
      <title>From Zero to Python: My Beginner Journey as a New Learner</title>
      <dc:creator>Hillary Nartey</dc:creator>
      <pubDate>Wed, 13 May 2026 10:35:04 +0000</pubDate>
      <link>https://dev.to/hillary_nartey/from-zero-to-python-my-beginner-journey-as-a-new-learner-3fk3</link>
      <guid>https://dev.to/hillary_nartey/from-zero-to-python-my-beginner-journey-as-a-new-learner-3fk3</guid>
      <description>&lt;p&gt;Who Am I and Why Am I Writing This?&lt;/p&gt;

&lt;p&gt;Hi everyone, my name is Hillary Nartey, and I just started learning Python a few days ago. Yes, just a few days ago, I was a complete beginner.&lt;/p&gt;

&lt;p&gt;I decided to document my journey from day one so that other newbies like me can follow along, learn from my mistakes, and hopefully feel less alone in the process. If you are thinking about learning Python and don't know where to start, this post is for you.&lt;/p&gt;

&lt;p&gt;Why Python?&lt;/p&gt;

&lt;p&gt;I chose Python because it is one of the most beginner-friendly programming languages out there. It is widely used in data science, web development, automation, and artificial intelligence, so learning it opens a lot of doors.&lt;/p&gt;

&lt;p&gt;I want to build real skills that are useful in today's world, and Python felt like the perfect starting point.&lt;/p&gt;

&lt;p&gt;The Tools I Am Using&lt;/p&gt;

&lt;p&gt;You don't need to spend any money to start learning Python. Here are the free tools I am using:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Google Colab&lt;br&gt;
This is a free online tool that lets you write and run Python code directly in your browser, no installation needed. It is perfect for beginners because you can just open it and start coding right away.&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;a href="https://colab.research.google.com" rel="noopener noreferrer"&gt;colab.research.google.com&lt;/a&gt;
&lt;/h2&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Coursera (Free Audit)&lt;br&gt;
I am taking Python courses on Coursera for free by using the &lt;strong&gt;audit&lt;/strong&gt; option. When you open a course, look for a small "Audit" link below the enroll button. You get access to all the video lectures and most course materials — without paying a cent.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A great beginner course to look for is &lt;strong&gt;"Python for Everybody"&lt;/strong&gt; by the University of Michigan.&lt;br&gt;
&lt;a href="https://www.coursera.org" rel="noopener noreferrer"&gt;coursera.org&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I tried installing #Anaconda on my laptop, but was facing difficulty that why I opted for Colab&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Have Learned So Far
&lt;/h2&gt;

&lt;p&gt;I have only been at this for a few days, but here is what I have covered so far:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What Python is and why it is popular&lt;/li&gt;
&lt;li&gt;How to write your first line of code: `print("Hello, World!").&lt;/li&gt;
&lt;li&gt;Basic Python syntax and how to run code in Google Colab&lt;/li&gt;
&lt;li&gt;Variables and data types (strings, integers, floats)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It might not sound like much, but every expert started exactly where I am right now.&lt;/p&gt;

&lt;h2&gt;
  
  
  My First Python Code
&lt;/h2&gt;

&lt;p&gt;Here is the very first piece of code I wrote:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;python&lt;br&gt;
print("Hello, World!")&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Simple, right? But seeing those words appear on the screen for the first time felt amazing. It made everything feel real.&lt;/p&gt;

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

&lt;p&gt;I plan to keep learning step by step and document everything here. Coming up next:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Python lists, loops, and conditions&lt;/li&gt;
&lt;li&gt;Writing simple functions&lt;/li&gt;
&lt;li&gt;Mini beginner projects&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  A Message to Other Beginners
&lt;/h2&gt;

&lt;p&gt;If you are just starting like me, don't be discouraged by how much there is to learn. Focus on one small thing at a time. Celebrate the small wins. And don't be afraid to make mistakes,__ that's how we learn.&lt;/p&gt;

&lt;p&gt;You don't have to be an expert to start. You just have to start.&lt;/p&gt;

&lt;p&gt;Follow along with my journey, and let's learn Python together.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Written by Hillary Nartey | Beginner Python Learner&lt;/em&gt;&lt;br&gt;
&lt;em&gt;Feel free to leave a comment if you are also just starting. Let's connect!&lt;/em&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>beginners</category>
      <category>opensource</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
