Helper Snakes

Simple Python 3 files written to assist with gardening.

Seeds.py

Calculates the expected dates of germination and harvest based on user-inputted seed packet info. List is ordered from earliest to latest expected harvest dates.

Example Output:

Today is 2020-04-16

AFRICAN DAISY
Germinate by: 2020-04-30
Harvest by: 2020-05-31

MESEMBRYANTHEMUM
Germinate by: 2020-04-30
Harvest by: 2020-07-25

ONION
Germinate by: 2020-04-30
Harvest by: 2020-12-12


Process finished with exit code 0

Code:

import datetime

seeds=[]

def addSeed(name,days_to_germination,days_to_harvest):
    thisdict = {
        "name": name,
        "germ": days_to_germination,
        "harvest": days_to_harvest
    }
    seeds.append(thisdict)

def getDates(list):

    print("Today is " + str(datetime.date.today()) + "\n")
    for entry in sorted(list, key = lambda i: (i['harvest'])):
        print(entry["name"].upper())
        print("Germinate by: " + str(datetime.date.today() + datetime.timedelta(days=entry["germ"])))
        print("Harvest by: " + str(datetime.date.today() + datetime.timedelta(days=entry["harvest"])) + "\n")

########################################################################################################################
# SEED LIST:
# Add seeds in the space below according to example: Name, Number of days to germinate, Number of days to harvest
########################################################################################################################

addSeed("onion", 14, 240)
addSeed("African Daisy", 14, 45)
addSeed("Mesembryanthemum", 14, 100)

########################################################################################################################
#End user input 
########################################################################################################################
getDates(seeds)

#taraomar.co.za