diff --git a/src/saniya-exp-plant-watering-tracker/README.md b/src/saniya-exp-plant-watering-tracker/README.md new file mode 100644 index 0000000..dfccb49 --- /dev/null +++ b/src/saniya-exp-plant-watering-tracker/README.md @@ -0,0 +1,59 @@ +# 🌱 Virtual Plant Watering Tracker & Reminder + +A beginner-friendly Python project to help you track your plants' watering schedules, get reminders, and manage your garden efficiently! Keep your plants happy, hydrated, and blooming.πŸŒΏπŸ’§πŸͺ΄ + +--- + +## πŸ“‚ Project Folder Structure +src/ saniya-exp-plant-watering-tracker/ main.py plants.csv README.md +--- + +## 🧩 Features +- πŸ’§ Check watering reminders for all your plants. +- πŸͺ΄ Update plants you have watered today. +- 🌱 Add new plants to your garden dynamically. +- πŸ“Š View all plants and their details in a neat tabular format. +- πŸ“† See next watering dates for all your plants. +- πŸš€ Multiple runs in a single session. +- πŸ‘‹ Friendly greetings ("Hello" and "Goodbye") for an interactive experience. + +--- + +## πŸ“„ CSV File (`plants.csv`) +The program uses a CSV file to store plant data. This file contains three columns: + +| Column Name | Description | +|------------------|-----------------------------------------------| +| `plant_name` | Name of the plant | +| `last_watered` | The last date the plant was watered (YYYY-MM-DD) | +| `water_interval_days` | Number of days after which the plant needs watering | + +> **Note:** If you want to track more plants, simply add new entries to this CSV file following the same format. + +--- + +## πŸ’» How to Run +1. Make sure you have Python installed (preferably Python 3.10+). +2. Install the required package: + pip install pandas +3. Run the program: + python main.py +4. Follow the interactive prompts to: + - Check watering reminders + - Update watered plants + - Add new plants + - View all plants + - See next watering dates +5. Exit when done by selecting the "Exit" option. + +--- + +## 🌟 Additional Notes +- βœ… The program is beginner-friendly and runs directly with the CSV file included. +- βœ… You can add new plants at any time, and the CSV will update automatically. +- βœ… Make sure the CSV file (`plants.csv`) stays in the same folder as `main.py` for proper functionality. +- βœ… Added ability to log plant growth and notes for each plant. + +--- + +Enjoy managing your plants and keeping them healthy! 🌸🌼πŸͺ΄ diff --git a/src/saniya-exp-plant-watering-tracker/main.py b/src/saniya-exp-plant-watering-tracker/main.py new file mode 100644 index 0000000..27f6430 --- /dev/null +++ b/src/saniya-exp-plant-watering-tracker/main.py @@ -0,0 +1,130 @@ +import pandas as pd +from datetime import datetime, timedelta +import os +import time + +# 🌱 Welcome Message +print("🌷🌸🌿 Welcome to the Virtual Plant Watering Tracker & Reminder! 🌿🌸🌷") +print("-------------------------------------------------------------") +print("🌞 Let's keep your plants happy, hydrated, and blooming! πŸ’§πŸͺ΄\n") + +# πŸ“Š Read the CSV +data = pd.read_csv("plants.csv") +data['last_watered'] = pd.to_datetime(data['last_watered']) +if 'notes' not in data.columns: + data['notes'] = "" + +# πŸͺ΄ Helper functions +def show_all_plants(): + print("\nπŸ“‹ Your Current Garden Overview:") + print(data.to_string(index=False)) + print("-------------------------------------------------------------\n") + +def check_reminders(): + today = datetime.now().date() + print("\nπŸ’§ Checking which plants need watering today...\n") + time.sleep(1) + due_plants = [] + for _, row in data.iterrows(): + next_due = row['last_watered'].date() + timedelta(days=row['water_interval_days']) + if today >= next_due: + due_plants.append((row['plant_name'], next_due)) + if due_plants: + print("🌿 These plants need watering today 🌿:\n") + for name, next_due in due_plants: + print(f"🌸 {name} β€” was due on {next_due}") + else: + print("βœ… Great job! All your plants are well-watered and happy! πŸͺ΄πŸ’¦") + print("\n-------------------------------------------------------------\n") + +def update_watered(): + print("\nπŸͺ» Time to refresh your plants! πŸͺ»") + print("🌼 Available plants:", ", ".join(data['plant_name'])) + plants_input = input("πŸ’§ Enter the names of plants you watered today (comma separated): ") + watered = [p.strip().capitalize() for p in plants_input.split(",")] + today = datetime.now() + found_any = False + for name in watered: + if name in list(data['plant_name']): + data.loc[data['plant_name'] == name, 'last_watered'] = today + print(f"πŸ’¦ Watered {name}! Updated successfully.") + found_any = True + else: + print(f"⚠️ Plant '{name}' not found in your garden. Maybe check spelling?") + if found_any: + data.to_csv("plants.csv", index=False) + print("βœ… All updates saved successfully!\n") + print("-------------------------------------------------------------\n") + +def add_new_plant(): + print("\n🌱 Let's add a new plant to your garden! 🌱") + name = input("πŸͺ΄ Enter the plant name: ").capitalize() + try: + interval = int(input("πŸ“… Enter watering interval (in days): ")) + today = datetime.now().strftime("%Y-%m-%d") + new_entry = pd.DataFrame([[name, today, interval, ""]], columns=data.columns) + updated = pd.concat([data, new_entry], ignore_index=True) + updated.to_csv("plants.csv", index=False) + print(f"🌼 Successfully added {name} to your garden! πŸ’š") + except ValueError: + print("⚠️ Invalid input! Please enter a number for interval.") + print("-------------------------------------------------------------\n") + +def show_next_due(): + print("\nπŸ“† Checking next watering dates for all your plants...\n") + time.sleep(1) + for _, row in data.iterrows(): + next_due = row['last_watered'].date() + timedelta(days=row['water_interval_days']) + print(f"🌺 {row['plant_name']} β†’ Next watering due on {next_due}") + print("\n-------------------------------------------------------------\n") + +def add_growth_notes(): + print("\nπŸ“ Add Growth Notes for Your Plants") + print("🌱 Available plants:", ", ".join(data['plant_name'])) + plant_input = input("πŸ’§ Enter the plant name: ").capitalize() + if plant_input in list(data['plant_name']): + note = input("✍️ Enter your growth note: ") + if pd.isna(data.loc[data['plant_name'] == plant_input, 'notes']).all(): + data.loc[data['plant_name'] == plant_input, 'notes'] = note + else: + data.loc[data['plant_name'] == plant_input, 'notes'] += " | " + note + data.to_csv("plants.csv", index=False) + print(f"βœ… Note added for {plant_input} successfully!\n") + else: + print(f"⚠️ Plant '{plant_input}' not found!") + print("-------------------------------------------------------------\n") + +# 🌿 Main interactive loop +while True: + print("🌻 What would you like to do?") + print("1️⃣ πŸ’§ Check watering reminders") + print("2️⃣ πŸͺ΄ Update watered plants") + print("3️⃣ 🌱 Add a new plant") + print("4️⃣ πŸ“Š View all plants") + print("5️⃣ πŸ“† See next watering dates") + print("6️⃣ πŸ“ Add growth notes") + print("7️⃣ πŸšͺ Exit\n") + + choice = input("πŸ‘‰ Enter your choice (1-7): ").strip() + + if choice == "1": + check_reminders() + elif choice == "2": + update_watered() + elif choice == "3": + add_new_plant() + elif choice == "4": + show_all_plants() + elif choice == "5": + show_next_due() + elif choice == "6": + add_growth_notes() + elif choice == "7": + print("\nπŸ‘‹ Goodbye, Plant Parent! 🌼") + print("πŸ’§ Keep nurturing your green friends with love. 🌿✨") + print("-------------------------------------------------------------\n") + break + else: + print("⚠️ Oops! Invalid choice. Try again please.\n") + + diff --git a/src/saniya-exp-plant-watering-tracker/plants.csv b/src/saniya-exp-plant-watering-tracker/plants.csv new file mode 100644 index 0000000..e4c6dc1 --- /dev/null +++ b/src/saniya-exp-plant-watering-tracker/plants.csv @@ -0,0 +1,14 @@ +plant_name,last_watered,water_interval_days,notes +Rose,2025-10-05,3,New buds observed | happy +Tulip,2025-10-08,4,Leaves looking healthy +Lily,2025-10-03,7, +Orchid,2025-10-09,2,Flowers starting to bloom +Sunflower,2025-10-07,5, +Jasmine,2025-10-01,6,Scent is stronger +Mint,2025-10-04,2,Leaves are vibrant green +Basil,2025-10-06,3, +Aloe Vera,2025-10-02,7,Some leaves turning brown tips +Lavender,2025-10-05,5,New flowers forming +Cactus,2025-10-03,10, +Money Plant,2025-10-04,4,New shoots appeared +Snake Plant,2025-10-01,12,