<?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: AndreSilva</title>
    <description>The latest articles on DEV Community by AndreSilva (@dev_silva).</description>
    <link>https://dev.to/dev_silva</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%2F2205153%2Fe901cc1a-6ce9-4fcd-abad-066d2ea118de.jpg</url>
      <title>DEV Community: AndreSilva</title>
      <link>https://dev.to/dev_silva</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/dev_silva"/>
    <language>en</language>
    <item>
      <title>How I Built My First Python PET App (And What I Learned)</title>
      <dc:creator>AndreSilva</dc:creator>
      <pubDate>Wed, 16 Oct 2024 20:56:44 +0000</pubDate>
      <link>https://dev.to/dev_silva/how-i-built-my-first-python-pet-app-and-what-i-learned-1kfm</link>
      <guid>https://dev.to/dev_silva/how-i-built-my-first-python-pet-app-and-what-i-learned-1kfm</guid>
      <description>&lt;p&gt;Hello, DEV community! I'm Andre, a passionate beginner programmer diving into the world of Python. After wrestling with motivation for a few years, I decided to shift my focus to building real projects. Today, I want to share my story about creating my very first Python project: a Personal Expense Tracker (PET) app. (code at the end)&lt;/p&gt;

&lt;p&gt;The Personal Expense Tracker is a command-line application designed to help users log their daily expenses, categorize them, and gain insights into their spending habits. My goal was to create a tool that empowers users to take control of their finances. (and mine! ahah)&lt;/p&gt;

&lt;p&gt;One of the most significant challenges I faced was figuring out how to effectively store the expense data. I initially struggled with file handling in Python, but after some persistence, I finally implemented a working solution!&lt;/p&gt;

&lt;p&gt;Through this project, I learned the importance of user input validation and ensuring that data is recorded consistently. I also gained valuable experience in managing files in Python to store and retrieve expense records.&lt;/p&gt;

&lt;p&gt;Looking ahead, I plan to integrate data visualization features to help users see their spending patterns visually. Plus, I'm excited to implement a budgeting tool that allows users to set spending limits by category.&lt;/p&gt;

&lt;p&gt;Completing the Personal Expense Tracker has been an incredibly rewarding experience, boosting my confidence as a developer. I’m eager to continue my learning journey into backend development and DevOps, with more projects on the horizon!&lt;/p&gt;

&lt;p&gt;I’d love to hear your feedback! If you’ve built something similar or have tips for enhancing expense trackers, please share your insights!&lt;/p&gt;

&lt;p&gt;`&lt;/p&gt;

&lt;p&gt;def pet():&lt;br&gt;
    print("Welcome to PET!")&lt;br&gt;
    print("Your Personal Expense Tracker, helping you keep track of your expenses.")&lt;br&gt;
    print("Expenses Categories:")&lt;br&gt;
    print("[1] Food &amp;amp; Groceries")&lt;br&gt;
    print("[2] Transportation (Fuel, Public Transportation, etc...)")&lt;br&gt;
    print("[3] Utilities (Electricity, Water, Internet, etc...)")&lt;br&gt;
    print("[4] Entertainment &amp;amp; Leisure")&lt;br&gt;
    print("[5] Healthcare &amp;amp; Medical Expenses")&lt;br&gt;
    print("[6] Rent &amp;amp; Mortgage")&lt;br&gt;
    print("[7] Miscellaneous (for any uncategorized expenses)")&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;categories = [
    "Food &amp;amp; Groceries",
    "Transportation (Fuel, Public Transportation, etc...)",
    "Utilities (Electricity, Water, Internet, etc...)",
    "Entertainment &amp;amp; Leisure",
    "Healthcare &amp;amp; Medical Expenses",
    "Rent &amp;amp; Mortgage",
    "Miscellaneous (for any uncategorized expenses)"
]

food = []
transportation = []
utilities = []
entertainment = []
healthcare = []
rent = []
miscs = []

while True:
    while True:
        try:
            choice = int(input("Select category: "))
            if 1 &amp;lt;= choice &amp;lt;= 7:
                break
            else:
                raise ValueError
        except ValueError:
            return "Choose a valid category!"

    while True:
            try:
                amount = float(input("Amount: "))
                break
            except ValueError:
                return "Invalid number! Enter the amount of the expense."

    if choice == 1:
        food.append(amount)
        print(f"${amount} added to {categories[0]}")
    elif choice == 2:
        transportation.append(amount)
        print(f"${amount} added to {categories[1]}")
    elif choice == 3:
        utilities.append(amount)
        print(f"${amount} added to {categories[2]}")
    elif choice == 4:
        entertainment.append(amount)
        print(f"${amount} added to {categories[3]}")
    elif choice == 5:
        healthcare.append(amount)
        print(f"${amount} added to {categories[4]}")
    elif choice == 6:
        rent.append(amount)
        print(f"${amount} added to {categories[5]}")
    elif choice == 7:
        miscs.append(amount)
        print(f"${amount} added to {categories[6]}")

    option = input("Do you want to add another expense? (Y/N)").lower()

    if option != 'y':
        break
    else: 
        continue

food_total = sum(food)
transportation_total = sum(transportation)
utilities_total = sum(utilities)
entertainment_total = sum(entertainment)
healthcare_total = sum(healthcare)
rent_total = sum(rent)
miscs_total = sum(miscs)

print("Options:")
print("[1] View total spent")
print("[2] View total per category")

while True:
    try:
        show_expenses = int(input("Choose an option: "))
        if 1 &amp;lt;= show_expenses &amp;lt;= 2:
            break
        else:
            raise ValueError
    except ValueError:
        return "Invalid! Insert a valid option."

if show_expenses == 1:
    total_expenses = food_total + transportation_total + utilities_total + entertainment_total + healthcare_total + rent_total + miscs_total
    print(f"Your total expenses: ${total_expenses}")
elif show_expenses == 2:
    print(f"{categories[0]} total is: ${food_total}")
    print(f"{categories[1]} total is: ${transportation_total}")
    print(f"{categories[2]} total is: ${utilities_total}")
    print(f"{categories[3]} total is: ${entertainment_total}")
    print(f"{categories[4]} total is: ${healthcare_total}")
    print(f"{categories[5]} total is: ${rent_total}")
    print(f"{categories[6]} total is: ${miscs_total}")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;pet()&lt;/p&gt;

&lt;p&gt;`&lt;/p&gt;

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